Sib-pair Command: date


ClassAnalysis and data manipulation command
Namedate
Arguments <quantitative_trait> [julian|gregorian|year] <format_string>

Convert a numeric variable from Julian to Gregorian, Gregorian to Julian, or Gregorian to "decimal" year, or a categorical variable from a date format (eg "d/m/Y", "Ymd") to Julian or Gregorian. The "chronological" Julian date is the number of days since the epoch, usually 1970-01-01 or -4712-01-01. Gregorian dates are represented as 8 (or 9) digit integers of the form of (-)YYYYMMDD. The decimal years are YYYY.x, where the decimal part is the day of year number (from 1...366) divided by the length of that year (365 or 366). The date formats are the relevant subset from those of the Unix date command or strptime:

dday (01-31),
mmonth (01-12),
bmonth (Jan-Dec),
yyear (yy),
Yyear (YYYY).
DUS style date ie m/d/y.
FISO style date ie Y-m-d.

Example:

>> date DOB julian
Converting dates at "DOB" from Gregorian to Julian (epoch="1970-01-01").
>>
>> set loc bday cat
>> read cases inline noid
>> 01-Jun-1964
>> 01-06-1964
>> 19640601
>> ;;;;
>> run
>> set nde 16 4 
>> set cat lab
>> wri
>> date bday greg
>> date bday greg d-m-Y
>> date bday greg d-b-Y
>> wri
>> recast bday cat
>> date bday julian 
>> wri
>> date bday greg
>> date bday year
>> wri

Converted 3 dates at "bday" to decimal years.
# Writing 3 pedigrees:
!  i f m s
!  d a o e
!    t t x       bday
!
1 1 x x  x        1964.4153
2 2 x x  x        1964.4153
3 3 x x  x        1964.4153


Sib-pair Command: date


ClassAnalysis and data manipulation command
Namedate
Arguments (<yyyymmdd> julian)| (<juldate> gregorian)

Convert a single date from Julian to Gregorian or Gregorian to Julian.

Example:

>> date 19000101
Date: 19000101 =    -25567

See also:

set epoch set epoch for Julian dates


<< (flip)Up to index>> (standardize)