AddDays

Time AddDays(Time start, Number days)

This will take an existing Time value and add given number of days to it. Then number added can be negative.

*start* - This is the time to which to add the specified number of days.

*days* - This is the number of days to add. The count is always rounded
the the nearest integer ( so you cannot add 36 hours by adding 1.5 days ).

AddHours, AddMinutes, AddSeconds, AddMillis

Time AddHours(Time start, Number hours) Time AddMinutes(Time start, Number minutes) Time AddSeconds(Time start, Number seconds) Time AddMillis(Time start, Number millis)

These will take an existing Time value and add given number of units to it. Then number added can be negative. The higher level units will be adjusted to handle any overflow/underflow in any particular field.

*start* - This is the time to which to add the specified number of units.

*hours* - This is the number of hours to add. The count is always rounded
the the nearest integer ( so you cannot add 90 minutes by adding 1.5 hours ).

*minutes* - This is the number of minutes to add. The count is always rounded
the the nearest integer ( so you cannot add 90 seconds by adding 1.5 minutes ).

*seconds* - This is the number of seconds to add. The count is always rounded
the the nearest integer ( so you cannot add 1500 milliseconds by adding 1.5 seconds ).

*millis* - This is the number of milliseconds to add. The count is always rounded
the the nearest integer.

DiffDays, DiffHours, DiffMinutes, DiffSeconds, DiffMillis

Time DiffDays(Time from, Time to) Time DiffHours(Time from, Time to) Time DiffMinutes(Time from, Time to) Time DiffSeconds(Time from, Time to) Time DiffMillis(Time from, Time to)

These will take the difference between two dates as measured in the specified units. The smaller units will be used in the calculation but the result will always be rounded to the nearest whole number of the requested units. It is always not possible to return a result for the smaller units for the full range of dates so the routines may generate a runtime error.

*from* - the base time for the comparison.

*to* - the target time for the comparison. If the target time
is later than the base time
then the result is positive; if earlier then the result is negative.

GetDate

Time GetDate(Time time)

This will extract just the date part from a date and time value. The time of day part of the result will be set to '00:00'.

*time* - The time from which to extract the date.

GetDay

Number GetDay(Time date)

This will extract just the day from a date and time value. The result will be in the range 1 to 28, 29, 30, 31 depending on the length of the month.

*date* - The date and time from which to extract the day.

GetHour

Number GetHour(Time time)

This will return the hour part of a time datum. If just the date has been set this will always return 0.

*time* - The date and time from which to extract the hour.

GetMilli

Number GetMilli(Time time)

This will return the millisecond part of a time datum. If just the date has been set this will always return 0.

*time* - The date and time from which to extract the milliseconds field.

GetMinute

Number GetMinute(Time time)

This will return the minute part of a time datum. If just the date has been set this will always return 0.

*time* - The date and time from which to extract the minute.

GetMonth

Number GetMonth(Time date)

This will extract just the month from a date and time value. The result will be in the range 1 to 12.

*date* - The date and time from which to extract the month.

GetSecond

Number GetSecond(Time time)

This will return the second part of a time datum. If just the date has been set this will always return 0.

*time* - The date and time from which to extract the seconds field.

GetTofD

Time GetTofD(Time time)

This will extract just the time of day part from a date and time value.

*time* - The time from which to extract the time of day.

GetWeekday

Number GetWeekday(Time date)

This will extract just the weekday from a date and time value. The result will be 1 for Monday up to 7 for Sunday.

*date* - The date and time from which to extract the weekday.

GetYear

Number GetYear(Time date)

This will extract just the year from a date and time value.

*date* - The date and time from which to extract the year.

MakeDate

Time MakeDate(Number year, Number month, Number day)

This will take a year/month/day triplet and generate a Time value for it ( the time of day part will be set to 00:00am ).

*year* - This is the year and should be in the range 1 to 9999.

*month* - This is the month number and should be in the range 1 ( January ) to 12 ( December ).

*day* - This is the day number and should be in the range 1 ( 1st ) to the number of days in
the specified month.

MakeTime

Time MakeTime(Time date, Time tod = '00:00')

This will build a complete Time datum from an existing date and time of day value.

*date* - The date part of the result is taken from this date.

*tod* - The time of day part of the result is taken from this time.

MakeTofD

Time MakeTofD(Number hour, Number minute, Number second = 0, Number millisec = 0)

This will take the various parts of a time of day and build a Time value for it ( the date part will be set to Null ). Only the hour and minute parameters are obligatory.

*hour* - This is the hour number and should be in the range 0 to 23.

*minute* - This is the minute number and should be in the range 0 to 59.

*second* - This is the optional second number and should be in the range 0 to 59 ( there is no support for leap seconds ).

*millisec* - This is the optional millisecond number and should be in the range 0 to 999.

Now

Time Now(Logical gmt = False)

This will return the current time from the operating system.

*gmt* - This is an optional flag telling the system to return Greenwich Mean Time ( or UTC ).