[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Issue with date function

From   "Nick Cox" <>
To   <>
Subject   st: RE: Issue with date function
Date   Mon, 7 Apr 2008 17:50:21 +0100

Extract from the help: 

  The date() function

    The syntax of function date() is

            date(string, mask [, topyear])


. di date("31/12/94", "DMY", 2010)

. gen datef = date(datestr, "DMY", 2010) 



I'm haing a problem with the date function when trying to convert a
variable into a date variables. My string variable is datestr and
dates in the following format "31/12/94", ie, DMY. I've tried to use the
date function using the following syntax:

gen datef = date(datestr, "DMY")

I've already used this deffinition and it worked well, but the date had
format "31/12/1994". Is there a way of using the date function with the
format I'm currently using, ie, with the last two digits in year?

*   For searches and help try:

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