Today Property




Today(  )


Sets or retrieves the current system date

Rules at a Glance

  • If you are setting the system date with numbers, as opposed to spelling the month, the sequence of Day, Month, and Year must be in the same sequence as the computer’s regional settings.

  • If you are running Microsoft Windows 95, 98, or 2000, the earliest system date you can set is January 1, 1980; the latest system date you can set is December 31, 2099.

  • The date is returned in the short date format defined by the system’s regional settings.


Today(  ) = "January 1, 1998"

Programming Tips and Gotchas

  • It is good programming practice to synchronize the dates across the machines in a multiuser environment, most commonly from the date on a server. This can be done at the operating-system level within the logon script or at application level using the Today property and TimeOfDay function.

  • It is risky to take a date format for granted. Wherever possible, use the Format function to explicitly set the date format that you require, prior to using a date value.

  • Modern Windows systems are more reliant on system date than ever before. A single machine can have literally hundreds of different applications installed, many of which will use dates in one way or another. You should respect the machine on which your application is running, and only in exceptional circumstances should you change the system date programmatically.

See Also

Now Property

Get VB.NET Language in a Nutshell, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.