DateTime is stored in nine bytes: 4 bytes for date, 5 bytes for time. 5 bytes for time include: 2 for millisec, 1 for sec, 1 for min, 1 for hour.
Bill,
There is a formatDate$() and a FormateTime$() function that might be of use in combination.
I just tried the following on a date time field:
FormatDate$(D_HARV_DATE) + " " + FormatTime$(D_HARV_DATE, "h:mm:ss tt")
And it gave me some joy. The format date does not have a lot of flexibility, but that has always been the case.
R
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
FormatDate$(D_HARV_DATE) + " " + FormatTime$(D_HARV_DATE, "h:mm:ss tt")
Bill,
I thought the date value was just an integer in the form of YYYYMMDD, but perhaps it is different behind the scenes. Are you doing some back-door stuff again?
I have mentioned something about the lack of cross-referencing in Mapbasic in the past and got quite flamed for the comment.
MapBasic is a very powerful language, but often you only find some of its functions by chance or (usually) from this list. There is a lot of power there that can be used in SQL in MapInfo as well that would be good if it were more exposed the more advanced punter (eg. area overlap, proportionoverlap to name just a couple).
R
--
Bill,Thanks for compiling this list. I'll forward it to our writers and ask them to add the cross references between the time/date functions.I think I have been over some of them, but I'm sure I didn't find them all
I think the easist way to find out is downloading the MITAB source. I am sure there is a comment in there which explains how dates and times are stored at the bit level inside the DAT file.
Using seconds since 1999-06-01 would be very unique
But actually I thought your description in the first post with hours, minutes, sec, msec etc. was how it looked inside the file?
It seems also that a date value when stored in a file is an integer representing the number of seconds elapsed since June 1, 1999. Can anyone confirm that I've always thought that Microsoft used Jan 1, 1970 as the start of time.
- Bill Thoen
--
Bill,
I thought the date value was just an integer in the form of YYYYMMDD, but perhaps it is different behind the scenes. Are you doing some back-door stuff again?
I have mentioned something about the lack of cross-referencing in Mapbasic in the past and got quite flamed for the comment.
CurTime - returns the current time as a time object
CurDateTime - returns the current date and time as an object
NumberToTime - creates a time object from a nine-digit integer in the form HHMMSSFFF and creates a Time object. For example, 214237582 represents 9:42:37.582 P.M. Similar conceptually to NumberToDate in that the value of a time object is always this kind of value. To see Time in more human readable ways you must format the time to a string.
Hour - retrieves the hour part of a time object as an integer (0-23)
Minute - retrieves the minute part of a time object as an integer (0-59)
Second - retrieves the second part of a time object as float (0-59.999)
FormatTime$ - returns a string representation of time based on formatting string
NumberToDateTime - creates a date time object from a seventeen-digit integer in the form YYYYMMDDHHMMSSFFF. For example, 20070301214237582 represents March 1, 2007 9:42:37.582 PM. Same notes as for time above.
GetDate - Grabs the Date part of a DateTime object
GetTime - Grabs the Time part of a Date Time object
MakeDateTime - Creates a datetime object from separate Date and Time objects
StringToTime - creates a time object from a string in the format set by your local time settings. So in US usually "hour:min:sec" but is whatever your local settings are.
StringToDateTime - creates a datetime object from a string using the Date and Time string format rules separated by a space.
Note that the StringTo... functions are for completeness and to unambiguous. In general, there is not differece between:
dim vDT as DateTime
vDT = StringToDateTime("04/01/12 13:14:15")
and
vDt = "04/01/12 13:14:15"
Professional will do its best to parse the string in either case.
I will make sure the docs folks are aware of the gaps here.
Eric Blasenheim
Pitney Bowes Software