Page 1 of 1

Converting date/time

Posted: Tue Jan 12, 2010 7:24 am
by Matt2222
Hi,

I have a time-series data set with 1-minute frequency data. The format of the timestamp is 20090630.2330 (i.e. yyyymmdd.hhmi). For some reason, I cannot tell Eviews to accept such a date/time format. Can anyone pls help?

Thx

Re: Converting date/time

Posted: Tue Jan 12, 2010 12:44 pm
by EViews Chris
If you've got the timestamp in a string or alpha series, then you can do the following:

series mydate = @dateval(datestring, "YYYYMMDD.HHMI")

where datestring is the string/alpha series containing the date

If you have it in a number, then you will have to first convert it to a string (with explicit trailing zeros) and then convert it as above:

series mydate = @dateval(@str(datenumber,"f.4"), "YYYYMMDD.HHMI")

where datenumber is the scalar/numeric series containing the date.

With most formats you can skip the middle step of converting to a string and use @makedate() to go straight from a number to an EViews date, but your format is outside the range of what @makedate() can understand.

You'll have to set the display format on the new series (mydate) to 'Day-Time' to see the results displayed as a human readable date.

Re: Converting date/time

Posted: Wed Jan 13, 2010 12:44 am
by Matt2222
Many thanks - that worked!

Re: Converting date/time

Posted: Wed Jun 02, 2010 7:33 am
by Matt2222
Hi,
I got another conversion question. I have the following date-time format: 20090701000002, i.e. "YYYYMMDDHHMISS", and I tried to use the following command in Eviews 6:
series mydate = @dateval(@str(time,"f.4"), "YYYYMMDDHHMISS") with time being my time variable
It only returned NaNs. Could you pls help? Thx