According to the > documentation < you use the Duration method to get the milliseconds between instants in time.
Then it is a matter of using the MakeInstant method to set the start and end dates and give Duration the instants it needs as input.
MakeInstant takes a "MM/DD/YYYY" string as input and you will need two of them -- one for the start date and one for the end date.
The last step is to convert the milliseconds returned by Duration to days to get the days between the two dates.
> Google < says there are 86400000 milliseconds in a day so divide the milliseconds returned by Duration by 86400000 to get the number of days between the dates.
--
Nice example Scott,
You can also add or subtract days, hours, minutes, seconds, weeks and years from an instant in time - there are dedicated blocks for these.
--
just another doubt .. if i put it as "12/2/2013 + 1 "..( i.e using appropriate math block) will it be treated as 13-2-2013.. and can > and < functions be used to check if current date is lesser or greater date when compared to a fixed date ?
--
if i put it as "12/2/2013 + 1 "..( i.e using appropriate math block) will it be treated as 13-2-2013
No. You must use the AddMonths method (If your date format is MM/DD/YYYY then to add one month to the date):
If your date format is DD/MM/YYYY then you would use the AddDays method instead to add one day to the date.
Convert each date to milliseconds and compare that. An earlier date will have fewer milliseconds than a later date:
--
In case you have never used a Clock component before,
In case you have never used a Clock component before,
you have to pull one in from the Designer screen
to get access to all the time conversion blocks.
--
to get access to all the time conversion blocks.
--
댓글 없음:
댓글 쓰기