Conversión de valores de feches

Les funciones siguientes converten valores de fecha pa calcular númberos y viceversa.

DateSerial Function

Devuelve un valor de Fecha pa un añu, mes o día especificaos.

DateValue Function

Devuelve un valor de fecha d'una cadena de fecha. La cadena de fecha ye una fecha completa nun valor numbéricu únicu. Tamién pue usar esti númberu de serie pa determinar la diferencia ente dos feches.

Day Function

Devuelve un valor que representa'l día del mes a partir d'un númberu de fecha serie xeneráu por DateSerial o DateValue.

Month Function

Devuelve'l mes d'un añu a partir d'una fecha serie que xenera la función DateSerial o DateValue.

WeekDay Function

Devuelve'l númberu correspondiente al día de la selmana representáu por un númberu de fecha serie que xenera la función DateSerial o DateValue.

Year Function

Devuelve l'añu a partir d'una fecha serie que xenera la función DateSerial o 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".

Iconu de nota

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.

Iconu de conseyu

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.


Iconu de nota

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

Devuelve la data como una estructura com.sun.star.util.Date de UNO.

CDateFromUnoDate Function

Convierte una estructura com.sun.star.util.Date de UNO a un valor de data.

CDateToUnoDateTime Function

Devuelve la parte horaria de la data como una estructura com.sun.star.util.DateTime de UNO.

CDateFromUnoDateTime Function

Convierte una estructura com.sun.star.util.Date de UNO a un valor de data.

DateAdd Function

Amiesta un intervalu a una fecha determinada una serie de vegaes y devuelve la fecha resultante.

DateDiff Function

Devuelve'l númberu d'intervalos de fecha ente dos valores de fecha determinaos.

DatePart Function

La función DatePart devuelve una parte concreta d'una fecha.