
January 15th, 2013, 01:07 PM
|
|
|
The date and time is stored as a Double Precision number relative to a particular start date (can't recall what that is at the moment). The part in front of the decimal point is the date, and the part behind is the time. It can be displayed in any different number of ways, the easiest being the system settings (long , medium, or short). The code below is VB6, but .Net will be similar.
Code:
Private Sub Command1_Click()
Dim dblDateTime As Double
dblDateTime = Now
Debug.Print dblDateTime
Debug.Print CStr(dblDateTime)
Debug.Print CDate(dblDateTime)
Debug.Print Format(dblDateTime, "MM/dd/yyyy hh:mm:ss AM/PM")
End Sub
resulting in:
41289.462650463
41289.462650463
01/15/13 11:06:13 AM
01/15/2013 11:06:13 AM
J.A. Coutts
|