Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 2 of 2 total |
substracting dates |
Sat, Aug 19 2017 12:33 PM | Permanent Link |
Paul Waegemans IMS bvba | I have 2 calendars and I want the number of days between the 2 selected dates in a counter (integer)
counter:=calendar2.SelectedDate-calendar1.SelectedDate; When I want to show the number of days: Showmessage(IntToStr(counter)); the number of days is not shown and the system is no longer reacting. What am I missing? Paul. |
Sat, Aug 19 2017 1:07 PM | Permanent Link |
Raul Team Elevate | On 8/19/2017 12:33 PM, Paul Waegemans wrote:
Paul > I have 2 calendars and I want the number of days between the 2 selected dates in a counter (integer) > counter:=calendar2.SelectedDate-calendar1.SelectedDate; > When I want to show the number of days: SelectedDate is a TimeDate type variable and as per EWB manual TimeDate represents milliseconds (since 1970) so your "counter" at this point is just milliseconds between the 2 dates and not days. If you want actual days then you'd need to also divide it by "milliseconds per day" which is 86400000 (24 hours x 60 min x 60sec x 1000 msec). > Showmessage(IntToStr(counter)); > the number of days is not shown and the system is no longer reacting. > What am I missing? Showmessage is modal and so it requires you to click OK You did not show actual code so i'm going to assume you are doing something else after calling showmessage (like showing/hiding forms or such which might hide the showmessage dialog). This works just fine here and shows results as expected: procedure TForm1.Button1Click(Sender: TObject); var counter:integer; begin counter := (Calendar2.selecteddate-Calendar1.selecteddate) div 86400000; showmessage(inttostr(counter)); end; Raul |
This web page was last updated on Friday, December 6, 2024 at 05:39 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |