Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
Days of the week |
Wed, May 7 2014 1:02 PM | Permanent Link |
Matthew Jones | How can I output "Monday" for a date two days ago? Apologies for the wrapping here,
but the segment I want to improve is marked //HERE function DateTimeToFriendly(tmDateTime : DateTime) : String; var szDate : String; tmToday : DateTime; begin if DayOf(tmDateTime) = DayOf(Now) then begin szDate := 'Today'; end else if DayOf(tmDateTime) = DayOf(JulToDate(DateToJul(tmToday) - 1)) then begin szDate := 'Yesterday'; end else if DayOf(tmDateTime) > DayOf(JulToDate(DateToJul(tmToday) - 6)) then begin // HERE szDate := DateToStr(tmDateTime); end else begin szDate := DateToStr(tmDateTime); end; Result := szDate; end; I can see that EWB has the TFormatSettings and that has the days of the week in long form, but I can't see how to work that out. DayOf is the date of the month, not the day of the week. I'm too used to libraries for this! /Matthew Jones/ |
Wed, May 7 2014 2:00 PM | Permanent Link |
Malcolm Taylor | Hi Matthew
I think you are looking for WeekDayOf() Malcolm |
Thu, May 8 2014 6:12 AM | Permanent Link |
Matthew Jones | Thank you!
szDate := FormatSettings.LongDayNames[WeekDayOf(tmDateTime)]; Works fine. /Matthew Jones/ |
This web page was last updated on Tuesday, April 23, 2024 at 08:10 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |