Konvertera datumvÀrden

Följande funktioner konverterar datumvÀrden till berÀkningsbara tal och tillbaka igen.

DateSerial Function

Returnerar ett Datum-vÀrde för ett visst Är, mÄnad eller dag.

DateValue Function

Returnerar ett datumvÀrde frÄn en datumstrÀng. DatumstrÀngen Àr ett fullstÀndigt datum i ett enskilt numeriskt vÀrde. Du kan ocksÄ anvÀnda det hÀr serienumret för att bestÀmma skillnaden mellan tvÄ datum.

Day Function

Returnerar ett vÀrde som representerar dagen i mÄnaden baserat pÄ ett seriellt datumtal genererat av DateSerial eller DateValue.

Month Function

Returnerar mÄnaden pÄ Äret frÄn ett seriellt datum som genereras av funktionen DateSerial eller DateValue.

WeekDay Function

This function returns the number corresponding to the weekday represented by a serial date number that is generated by the DateSerial or the DateValue functions.

Year Function

Returnerar Ärtal frÄn ett seriellt datumtal som genereras av funktionen DateSerial eller DateValue.

CDateToIso Function

Returns the date in ISO format without separators (YYYYMMDD) from a serial date number that is generated by the DateSerial or the DateValue or the CDateFromIso function.

The year part consists of at least four digits, with leading zeros if the absolute value is less than 1000, it can be negative with a leading minus sign if the date passed denotes a year before the common era (BCE) and it can have more than four digits if the absolute value is greater than 9999. The formatted string returned can be in the range "-327680101" to "327671231".

Symbolen Info

Years less than 100 and greater than 9999 are supported since LibreOffice 5.4.


CDateFromIso Function

Returns the internal date number from a string that contains a date in ISO format (YYYYMMDD or YYYY-MM-DD).

The year part must consist of either two (supported only in YYMMDD format without separators for compatibility) or at least four digits. With four digits leading zeros must be given if the absolute value is less than 1000, it can be negative with a leading minus sign if the date passed denotes a year before the common era (BCE) and it can have more than four digits if the absolute value is greater than 9999. The formatted string can be in the range "-327680101" to "327671231", or "-32768-01-01" to "32767-12-31".

An invalid date results in an error. Year 0 is not accepted, the last day BCE is -0001-12-31 and the next day CE is 0001-01-01. Dates before 1582-10-15 are in the proleptic Gregorian calendar.

Symbolen Tips

When converting a date serial number to a printable string, for example for the Print or MsgBox command, the locale's default calendar is used and at that 1582-10-15 cutover date may switch to the Julian calendar, which can result in a different date being displayed than expected. Use the CDateToIso Function to convert such date number to a string representation in the proleptic Gregorian calendar.


Symbolen Info

The YYYY-MM-DD format with separators is supported since LibreOffice 5.3.4. Years less than 100 or greater than 9999 are accepted since LibreOffice 5.4 if not in VBA compatibility mode.


CDateToUnoDate Function

Returnerar datumet som en UNO-struktur av typen com.sun.star.util.Date.

CDateFromUnoDate Function

Konverterar en struktur av typen com.sun.star.util.Date till ett datumvÀrde (Date).

CDateToUnoDateTime Function

Returnerar tidpunktsdelen av ett datum som en UNO-struktur av typen com.sun.star.util.DateTime.

CDateFromUnoDateTime Function

Konverterar en UNO-struktur av typen com.sun.star.util.DateTime till ett datumvÀrde (Date).

DateAdd Function

Adds a date or time interval to a given date a number of times and returns the resulting date.

DateDiff Function

Returns the number of date or time intervals between two given date values.

DatePart Function

Funktionen DatePart returnerar en viss del av ett datum.

Please support us!