Date() (or Now())
FormatDateTime()
Date() returns the current date
Now() returns the current date and time
You can use either one with FormatDateTime().
FormatDateTime allows you to change the way the date/time appears.
FormatDateTime(date(),vbgeneraldate) = 10/31/2006
FormatDateTime(date(),vblongdate) = Tuesday, October 31, 2006
FormatDateTime(date(),vbshortdate) = 10/31/2006
FormatDateTime(now(),vblongtime) = 10:25:49 AM
FormatDateTime(now(),vbshorttime) = 10:25
You can use number values instread of the vb values, per the following chart:
Constant | Value | Description |
---|---|---|
vbGeneralDate | 0 | Display a date in format mm/dd/yy. If the date parameter is Now(), it will also return the time, after the date |
vbLongDate | 1 | Display a date using the long date format: weekday, month day, year |
vbShortDate | 2 | Display a date using the short date format: like the default (mm/dd/yy) |
vbLongTime | 3 | Display a time using the time format: hh:mm:ss PM/AM |
vbShortTime | 4 | Display a time using the 24-hour format: hh:mm |
No comments:
Post a Comment