Print Page | Close Window

DateDiff Function in the Calendar Sample

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=14373
Printed Date: 06 October 2024 at 11:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: DateDiff Function in the Calendar Sample
Posted By: jpcoffeyXXX
Subject: DateDiff Function in the Calendar Sample
Date Posted: 24 May 2009 at 3:45pm
The use of the DateDiff function in the Calendar Sample application is baffling to me.  In the frmEditEvent in the Calendar sample, the following code is listed for the SetStartEnd function,

    If AllDay Then
cmbEndTime.Visible = False
cmbStartTime.Visible = False

If DateDiff("s", EndTime, 0) = 0 Then
EndDate = EndDate - 1
End If
End If
Also in the UpdateEventFromControls routine this code is listed,

    If chkAllDayEvent.Value = 1 Then
If DateDiff("s", TimeValue(EndTime), 0) = 0 Then
EndTime = EndTime + 1
End If
End If

Can someone clarify what this check is for?  I don't see why we have to add a day to the EndTime.  I don't understand why the DateDiff is being calculated against a value of 0.  I can understand that it is a comparison to see if there is a 0 value for EndTime, but why do they add the number 1 to the EndTime if the EndTime is indeed 0?  Why wouldn't they add a 1 to the StartTime instead?  Thanks for your feedback.

Sincerely,

John Coffey





Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net