DateTime Data Type

Holds 64-bit (8-byte) date and time values in the range 1 January 0001 00:00:00–31 December 9999 23:59:59.


Default value
When you declare a variable of type DateTime and leave it uninitialized,, its value defaults to 0000-00-00 00:00:00, which ViviFire considers an invalid date.
Type characters
DateTime has no type character.

DateTime literal

Date literal

@ year / month / day

Time literal

@ hours : minutes : seconds

Combined construction

@ year / month / day @ hours : minutes : seconds

The above named parts of a date or time must be decimal digits. Some additional rules follow.

Separates the parts of a date. If you prefer, you can also use dashes (-) or dots (.) instead.
You can specify a fraction of a second by placing a decimal point (.) between two sets of digits. The fractional part is limited to seven digits. Any additional digits are ignored.

Shared methods and properties

DateTime.Bits As UInt
Returns 64.
DateTime.Now As DateTime
Returns the local date and time of the system.
DateTime.UTCNow As DateTime
Returns the current date and time in UTC.

Type conversions

ViviFire can convert between the DateTime type and other types. Some conversions are limited to one direction only.

Converting to DateTime

From typeResult
integral typesWhen you add to or subtract from a DateTime a value such as 1, the integer represents 100 nanoseconds, (@0:0:0.0000001). Other values are a multiple of this.

Converting from DateTime

To typeResult
StringThe short date format specified by the user's locale and the time either as a 12- or 24-hour format likewise. If you try to convert the default value to String, the result is TBD.

Symmetric conversions

floating-point typesA value of 0.0 converts to @1899/12/30. Other whole numbers represent the number of days from this. Any values with fractional parts represent that fraction of a day (e.g., .5 represents 12 o'clock noon).


Dim foo As DateTime
foo = @2013/12/11@10:09:08

See also