Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Generate month and year from date or timestamp

Hello Community,

i want to generate date and month together from a timestamp. When I use the month-function it's only the month seperated from the year. The year-function is almost the same. Is there any way or function i can select month and year together? Thank you in advance

1 Reply
swuehl
MVP
MVP

Maybe you are looking for function Monthname() ?

MonthName(date [, shift = 0])

Returns a display value showing the month (formatted according to the MonthNames script variable) and year with an underlying numeric value corresponding to a timestamp with the first millisecond of the first date of the month. Shift is an integer, where the value 0 indicates the month which contains date. Negative values in shift indicate preceding months and positive values indicate succeeding months.

Examples:

monthname ( '2001-10-19' ) returns 'Oct 2001' with an underlying numeric value corresponding to '2001-10-01 00:00:00.000'

monthname ( '2001-10-19', -1 ) returns 'Sep 2001' with an underlying numeric value corresponding to '2001-09-01 00:00:00.000'