Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'a aware that this is a well documented topic. However, I haven't found the answer to the solution I need for a Master Calendar. I have set the formats as follows:
SET MonthNames='Jan;Feb;Mrz;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez';
SET DayNames='Mo;Di;Mi;Do;Fr;Sa;So';
SET LongMonthNames='Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember';
SET LongDayNames='Montag;Dienstag;Mittwoch;Donnerstag;Freitag;Samstag;Sonntag';
LET vTempDate = Today();
Then I generate a temporal table with daily dates, based on the variable vTempDate. Then I reload this temporal table and calculate all kind of "handles" to be used later with the GUI. Part of the script is as follows
...
WeekDay (vTempDate) as Wochentag,
date(vTempDate,'WWWW') as WochentagLang,
Week(vTempDate) as Woche,
num(Month(vTempDate)) as Monat,
month(date(vTempDate, 'MMMM')) as MonatLong,
month(vTempDate) as Monat_Name,
....
Now, the handle I'm still missing is MonatLong. That should read Januar, Februar, März, etc. with the underlying number of the month for sorting in the correct manner. However, all I have achieved so far, is that MonatLong comes out as Jan, Feb, Mrz,....
I also tried to generate long month names using
if(num(Month(vTempDate)) = 1,'Januar',if(num(Month(vTempDate))=2,'Februar',if(num(Month(vTempDate))=3,'März',if(...
or
Date#(date(vTempDate, 'MMMM')) as MonatLong,
But then the correct sorting order (according to number of Month) is lost and MonatLong just sorts in an alphabetical order.
Anyone any ideas? Thanx and kind regards
Try
Dual(date(vTempDate, 'MMMM'),Month(vTempDate) ) as MonatLong,
Try this for MonthLong and it should sort without any other modification by sorting it by numeric ascending:
Date(MonthStart(vTempDate), 'MMMM') as MonatLong,
If I understand your requirement, you need long month name..
If that is write then all you need to do is change the value of variable Monthname as below.
SET MonthNames='Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember';
Same with Day Name.
and then use normal function month(Date) to get the long month name.
Regards,
Kaushik Solanki
Hi Sunny,
I think that will create multiple distinct values for a given Month over years.
Hmmm, that is a very good point
In the following script line:
:
month(date(vTempDate, 'MMMM')) as MonatLong,
:
remove the Month() function call. Month will reset the format back to short month names. Date on its own will do the trick, like:
:
date(vTempDate, 'MMMM') as MonatLong,
:
Of course, since the underlying value will still be a date, your long month name will appear for every different date value (and every month name will appear many times in a list box). If you want to avoid that, use MonthStart to pre-format the date value, as Sunny suggested.
Peter
Hi Sunny Ti
You're solution worked too! 🙂
Great