Purpose
Use this function to snap/round the time as per the given time units. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
TimeSnap(input_time, time_unit, currentOrNext)
input_time (Date): A time input parameter
date_unit (String): Time units from below values.
-
hr
-
mi
-
sec
currentOrNext (Logical): Snap to current period or next.
Return Value
Time
Example
print TimeSnap(140520571, "hr", TRUE)
//returns 140000000
print TimeSnap(140520571, "hr", FALSE)
//returns 150000000
print TimeSnap(140520571, "min", TRUE)
//returns 140500000
print TimeSnap(140520571, "min", FALSE)
//returns 140600000
print TimeSnap(140520571, "sec", TRUE)
//returns 140520000
print TimeSnap(140520571, "sec", FALSE)
//returns 140521000