getting month from date

sreekuax

Member
DISPLAY TODAY. - will give the current date.
If the date is eg : 09/01/2010 (MM/DD/YY format) How I can get the month i.e 09 from this date into a variable and display it ?

Please help
 

davidvilla

Member
DISPLAY MONTH(TODAY)

There are functions to display the DAY, MONTH and YEAR
DAY(TODAY)
MONTH(TODAY)
YEAR(TODAY)
 

davidvilla

Member
You can set the date format of the session using SESSION:DATE-FORMAT and set it as 'mdy' or 'dmy'.
The DATE functions behave as per the session's date format.
 

sreekuax

Member
Thanks David...
I was thinking and at last I tried and found a way for displaying it
here it is :

def var x as char no-undo.
assign x = string(today).
x = substring(x, 1, 2).
display x.

which will return '09' i.e month .
Any how it was great to know there are functions for this. thanks Bro.. I can use it next time :)
 

davidvilla

Member
But, you will have to change the substring parameters with the session's date format. Instead you can use the inbuilt function. :)
 
Top