Sunday, 8 September 2013

LongDayNames deprecated and returns wrong values

LongDayNames deprecated and returns wrong values

I'm trying to make sense out of this on Lazarus Pascal
Note: dtWeekEnding is of type TDateEdit
ShowMessage( LongDayNames[DayOfTheWeek( dtWeekEnding.Date) ]);
My output expected is the name of the day for a given value in
dtWeekEnding. But I have to issues:
I get a warning that LongDayNames is deprecated. Then what should I use?
The day name returned is incorrect. On the (drop down) calendar, it
clearly shows the day but the message box is a day before it.
Am I missing something? Please advice.
Edit: For what it's worth, I tried this:
ShowMessage( LongDayNames[DayOfTheWeek( dtWeekEnding.Date) +1 ]); //Added
1 to the answer.
When I tried the above change, all days come out correctly BUT not Sunday.
Sunday doesn't show at all. For example, selecting September 1st shows
nothing as the name of the day.
Thanks!

No comments:

Post a Comment