Difference between revisions of "Documentation/DevGuide/Basic/Date and Time Functions"
m |
m |
||
Line 8: | Line 8: | ||
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Basic/{{SUBPAGENAME}}}} | {{Documentation/DevGuideLanguages|Documentation/DevGuide/Basic/{{SUBPAGENAME}}}} | ||
{{DISPLAYTITLE:Date and Time Functions}} | {{DISPLAYTITLE:Date and Time Functions}} | ||
− | {{ | + | {{AOo}} Basic supports several Visual Basic compatible statements and functions to perform date and time calculations. The functions are <code>DateSerial</code>, <code>DateValue</code>, <code>Day</code>, <code>Month</code>, <code>WeekDay</code>, <code>Year</code>, <code>Hour</code>, <code>Now</code>, <code>Second</code>, <code>TimeSerial</code>, <code>TimeValue</code>, <code>Date</code>, <code>Time</code>, and <code>Timer</code>. |
The function <code>Date</code> 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. | The function <code>Date</code> 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. |
Revision as of 14:43, 10 December 2020
- Screen I/O Functions
- File I/O
- Date and Time Functions
- Numeric Functions
- String Functions
- Specific UNO Functions
Apache OpenOffice 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). |