Cicode Programming Reference > Cicode Function Categories > Time and Date Functions Introduction > TimeMidNight

TimeMidNight

Returns the number of seconds between midnight on January 1, 1970, and the midnight immediately prior to the specified time/date. This function is useful for performing calculations with the time and date.

Time/date functions can only be used with dates from 1980 to 2035. You should check that the date you are using is valid with Cicode similar to the following:

IF StrToDate(Arg1)>0 THEN
...
ELSE
...
END

Syntax

TimeMidNight(Time)

Time:

The time/date variable.

Return Value

A time/date variable.

Related Functions

TimeCurrent

Example

timeNow = TimeCurrent();
! get the time variable at 7am today
time7am = TimeMidNight(timeNow) + 7*60*60;
IF timeNow > time7am AND timeNow < time7am + 10 THEN
Beep();
Prompt("Wake Up!");
END

See Also

Time/Date Functions