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 |
DateTime calculations in EWB |
Wed, Aug 22 2012 3:23 AM | Permanent Link |
Uli Becker | I want to validate a Date entered by a user. I can't see how to
calculate with DateTime in EWB? E.g.: (pseudocode) if StrToDate(edMyDate.text) > date + 90 then... thanks. Uli |
Thu, Aug 23 2012 4:15 AM | Permanent Link |
Mark Brooks Slikware | <<I want to validate a Date entered by a user. I can't see how to
calculate with DateTime in EWB?>> TDateTime's are really just integers so you can add and subtract them. For example, I have the following code to return a string representation of "some time ago": function CastrumDateTimeAgoToStr(const ADateTime: DateTime): string; var DT: integer; begin // Never if integer(ADateTime) = 0 then begin Result := 'Never'; exit; end; DT := (integer(Now) - integer(ADateTime)) div 1000; // Less then 60 seconds if DT < 60 then Result := 'Less then a minute ago' // Less than one hour else if DT < (60 * 60) then Result := IntToStr(DT div 60) + ' minute(s) ago' // Less than one day else if DT < (60 * 60 * 24) then Result := IntToStr(DT div (60 * 24)) + ' hour(s) ago' else Result := IntToStr(DT div (60 * 60 * 24)) + ' day(s) ago'; end; Hope this helps Mark |
Thu, Aug 23 2012 4:37 AM | Permanent Link |
Uli Becker | Mark,
> Hope this helps Yes, it does! I have to get used to "think" in Javascript. Thanks Uli |
This web page was last updated on Monday, October 14, 2024 at 05:15 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |