OOo Basic has functions to determine the current date and time: Date, Time, and Now (described in Table 2 ). The Date and Time functions return a string with the current date and time, respectively. The strings are formatted based on the current locale (Tools Options Language Settings Language; and then set the locale). The Now command returns a Date object that contains both the current date and the current time.
Function | Description |
---|---|
Date | Return the current date as a String. |
Now | Return the current date and time as a Date object. |
Time | Return the current time as a String. |
Note | Now returns a Date object, which internally is stored as a Double. The functions Date and Time both return a String. |
Printing the date and time is easy.
Print Date Print Time
Compatibility | In Visual Basic, Date$ and Time$ return a String and value, but Date and Time return numerical-based types suitable for mathematical operations. OOo Basic supports all four functions, but they all return a String. |
The Date and Time functions are documented to set the system date and time. This is not currently supported.
Date = 12/25/2003 Time = 22:14:03
Bug | As of OOo 1.1.0, setting the date and time does nothing. |