Retrieving date format?
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Retrieving date format?
Is there some way to retrieve the format from a date? I have noticed that the @date() in the pagestruct command senses the date format of its argument series. Is this functionality available also outside pagestruct? If not, is there some way to retrieve the date format that is used in a page's sample/range?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Retrieving date format?
I'm not sure I understand what you're asking - a page doesn't have a "date format".
Re: Retrieving date format?
A page's sample/range is specified by two dates. Those dates have format. Is there someway to retrieve that format? Or, for that matter, the format for any arbitrary date string?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Retrieving date format?
That format is not stored with the workfile. It is a global setting in that particular copy of EViews. There is no way to retrieve a user's particular setting.
Re: Retrieving date format?
Alright. But is there any way to retrieve the format of an arbitrary date? So, that I from "2010Q3" could get "YYYY[Q]Q"?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Retrieving date format?
I'm going to interpret that to mean that you have a string or some sort (a string object, a % variable or an alpha series) that contains a string representation of a date, and you want to retrieve the format of that string representation. There is no function to do that.
Re: Retrieving date format?
That was precisely what I meant :-) Would you consider adding it? It seems that the functionality is already there as the code below yields the expected result.
Ideally, there would be a @dateformat function that takes a date string, e.g. "2012Q3", and an optional date value (corresponding to the string) and returns the date format of the string. Just as @dateval it would not always succeed. Then it would return "NA".
Code: Select all
!mydateval=@dateval("2012Q3")-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Retrieving date format?
The problem is that it is often ambiguous without the date value, and sometimes ambiguous even with the date value.
What is @dateformat("2012:1"), even if given a date value corresponding to Jan 1st 2012?
How about "01/01/2012"?
What is @dateformat("2012:1"), even if given a date value corresponding to Jan 1st 2012?
How about "01/01/2012"?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Retrieving date format?
Or, I give you the date value for 12 December 2012, and ask for the date format of "12/12/12". What is that format?
Re: Retrieving date format?
"NA" I guess :-) To me that seems exactly the type of example that would leave also @dateval puzzled. I am not at my computer right now but I presume that @dateval("10/11/12") would similarly return NA.
Who is online
Users browsing this forum: No registered users and 2 guests
