Date Statement

Named Arguments

No

Syntax

Date = newdate


newdate

Use: Required

Date Type: String, Date, or Date Variant

Any valid date value.

Description

Sets 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 under Microsoft Windows, the earliest system date you can set is January 1, 1980; the latest system date you can set is December 31, 2099.

  • For Microsoft Windows NT, the earliest and latest system dates are January 1, 1980 and December 31, 2079, respectively.

Example

Date = "31 January 1998"

Programming Tips and Gotchas

  • It's 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 Date and Time statements.

  • To bulletproof your application from curious users who want to see what happens if they change the regional settings to Danish, your application from being installed on a new system on which the system administrator forgets to change the regional settings to your locale, and a host of other ways in which the computer your application is running on has regional settings different from those you expect, you should never take a date for granted. Wherever possible, use the Format function to explicitly set the date format you require prior to using a date value.

  • Modern windows systems are more reliant on the 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 very exceptional circumstances should you change the system date programmatically.

See Also

Date Function, IsDate Function
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.37.240