Page 1 of 1

how to get a string of a month from a scalar

Posted: Sun May 15, 2016 3:39 am
by melamel
hello,
I want to get a string month from a number, so I wonder If there is a function which transforms a number to a string of the month corresponding to the number I give in input, for example if I give 3 it will gives me Mars...etc but I want it just for the month, not for the hole date. Can you help me please ?

Re: how to get a string of a month from a scalar

Posted: Sun May 15, 2016 4:30 am
by EViews Gareth
I am sure there is an easier way, but I am drawing blank at the moment, so this rough idea will have to do.

You can use @datestr to convert a date number into a string, including just the month part.

The trick is going to be getting a date number from your "3".

You could start with the date value associated with the date "01/01/2016", then use the @dateadd function to add months to it to end up with a valid date number to use.

Re: how to get a string of a month from a scalar

Posted: Sun May 15, 2016 6:41 am
by melamel
Thank you very much! It worked well :D