Visual Basic/Date and Time
Jump to navigation Jump to search
- Now() - date and time of the present moment
- Day() - day of the month, from 0 to 31
- DateValue() - Given a timestamp, returns that timestamp with the time part cleared. Given a string, returns a timestamp with its date portion specified by that string.
- DateNow = DateValue(Now)
- TimeValue() - Given a timestamp, returns that timestamp with the date part cleared. Given a string, returns a timestamp with its time portion specified by that string.
- TimeNow = TimeValue(Now)
- Weekday() - 1-7
- If Weekday(Now) = vbSaturday Then MsgBox "It is Saturday."
- Localized name of the week day.
- TodaysWeekdayName = WeekdayName(Weekday(Now, vbUseSystem))
- Works even in non-U.S. locale.
- Later = DateAdd("d", 31, Now) ' 31 days later
- Formatted = Format(Now, "yyyy-MM-dd") ' e.g. 2016-09-17
Date and Time can be treated as a variables to be read from and written to. However, writing to them changes system date or time, which you usually do not want to do.
- vbSunday = 1, vbMonday, vbTuesday, vbWednesday, vbThursday, vbFriday, vbSaturday = 7
- vbGeneralDate = 0 , vbLongDate, vbShortDate, vbLongTime, vbShortTime = 4
- Date Time Functions In Visual Basic, vb6.us
- DateAdd Function - Visual Basic 6.0, chennaiiq.com
- Formating dates and times in VB6, vb6.us
- WeekdayName Function - Visual Basic 6.0, chennaiiq.com
- Finding the Beginning or End of a Week, msdn.microsoft.com
- DateDiff Function - Visual Basic 6.0, chennaiiq.com