Stata 15 help for date

[FN] Date and time functions


date(s1,s2[,Y]) Description: the e_d date (days since 01jan1960) corresponding to s1 based on s2 and Y

s1 contains the date, recorded as a string, in virtually any format. Months can be spelled out, abbreviated (to three characters), or indicated as numbers; years can include or exclude the century; blanks and punctuation are allowed.

s2 is any permutation of M, D, and [##]Y, with their order defining the order that month, day, and year occur in s1. ##, if specified, indicates the default century for two-digit years in s1. For instance, s2="MD19Y" would translate s1="11/15/91" as 15nov1991.

Y provides an alternate way of handling two-digit years. When a two-digit year is encountered, the largest year, topyear, that does not exceed Y is returned.

date("1/15/08","MDY",1999) = 15jan1908 date("1/15/08","MDY",2019) = 15jan2008

date("1/15/51","MDY",2000) = 15jan1951 date("1/15/50","MDY",2000) = 15jan1950 date("1/15/49","MDY",2000) = 15jan1949

date("1/15/01","MDY",2050) = 15jan2001 date("1/15/00","MDY",2050) = 15jan2000

If neither ## nor Y is specified, date() returns missing when it encounters a two-digit year. See Working with two-digit years in [D] datetime translation for more information. Domain s1: strings Domain s2: strings Domain Y: integers 1000 to 9998 (but probably 2001 to 2099) Range: %td dates 01jan0100 to 31dec9999 (integers -679,350 to 2,936,549) or missing

daily(s1,s2[,Y]) Description: a synonym for date(s1,s2[,Y])

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index