Difference between revisions of "Documentation/DevGuide/Basic/Date and Time Functions"
(Initial author Sun Microsystems, Inc.) |
m (1 revision(s)) |
(No difference)
|
Revision as of 12:35, 15 February 2008
- Screen I/O Functions
- File I/O
- Date and Time Functions
- Numeric Functions
- String Functions
- Specific UNO Functions
OpenOffice.org Basic supports several Visual Basic compatible statements and functions to perform date and time calculations. The functions are DateSerial
, DateValue
, Day
, Month
, WeekDay
, Year
, Hour
, Now
, Second
, TimeSerial
, TimeValue
, Date
, Time
, and Timer
.
The function Date
returns the current system date as a string and the function Time returns the current system time as a string. The other functions are not explained.
In the UNO/toolkit controls context there are two other functions. The date field control method com.sun.star.awt.XDateField:setDate() expects the date to be passed as a long value in a special ISO format and the com.sun.star.awt.XDateField:getDate() returns the date in this format.
The Basic runtime function CDateToIso
converts a date from the internal Basic date format to the required ISO date format. Since the string date format returned by the Date
function is converted to the internal Basic date format automatically, Date
can be used directly as an input parameter for CDateToIso
:
IsoDate = CDateToIso(Date) oTextField.setDate(IsoDate)
The runtime function CDateFromIso
represents the reverse operation and converts a date from the ISO date format to the internal Basic date format.
Dim aDate as date aDate = CDateFromIso(IsoDate)
Please see also Programming Dialogs and Dialog Controls in this context.
Content on this page is licensed under the Public Documentation License (PDL). |