TimeSnap() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

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