>In command window I have witten ?cmonth(date()) like this and enter return value in main vfp window current month name. example(october) but i want month and year for example(october 2009).
>
>How to do this?
There are several things you can do here. Tore gave you the specific reply, but you should also be aware of the following:
There are several functions that return different aspects of a date; this includes day(), month(), year() (day, month, and year), dow() (dow of week), and others.
When combining different pieces of data (in your example you wanted the month and the year), you usually convert everything to character data type. Since the year() will return a number, you convert it to text, with a function like transform(), str(), or padl().
If you need the same format over and over again, you may want to create a user-defined function for this.
If you want the month in another language, you may want to create a user-defined function for this. It is extremely simple; see sample code below.
function mycmonth(tcDate)
do case
case month(tcDate) = 1
return "January"
case month(tcDate) = 2
return "February"
...
case month(tcDate) = 12
return "December"
otherwise
return "???"
endcase
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)