Collaboration diagram for Date API:

Macros

#define RDM_DATE_MAX   RDM_UINT32_MAX
 

Functions

const char * rdm_dateDayAbr (RDM_PACKED_DATE_T dt)
 Get the day abbreviation. More...
 
const char * rdm_dateDayName (RDM_PACKED_DATE_T dt)
 Get the day name. More...
 
uint16_t rdm_dateDayOfMonth (RDM_PACKED_DATE_T dt)
 Get the day of the month. More...
 
uint16_t rdm_dateDayOfWeek (RDM_PACKED_DATE_T dt)
 Get the day of the week. More...
 
uint16_t rdm_dateDayOfYear (RDM_PACKED_DATE_T dt)
 Get the day of the year. More...
 
RDM_RETCODE rdm_dateFromString (const char *str, RDM_DATE_FORMAT date_fmt, RDM_PACKED_DATE_T *pdv)
 Convert from a string to a date. More...
 
uint16_t rdm_dateMonth (RDM_PACKED_DATE_T dt)
 Get the month. More...
 
const char * rdm_dateMonthAbr (RDM_PACKED_DATE_T dt)
 Get the month abbreviation. More...
 
const char * rdm_dateMonthName (RDM_PACKED_DATE_T dt)
 Get the month name. More...
 
RDM_RETCODE rdm_dateNowAsString (int16_t time_zone, char *datebuf, size_t buflen)
 Get the current date as a string. More...
 
uint16_t rdm_dateQuarter (RDM_PACKED_DATE_T dt)
 Get the quarter of the year. More...
 
RDM_RETCODE rdm_dateToday (int16_t time_zone, RDM_PACKED_DATE_T *pdt)
 Get the current date. More...
 
RDM_RETCODE rdm_dateToString (RDM_PACKED_DATE_T dateVal, RDM_DATE_FORMAT date_fmt, char date_sep, char *buf, size_t bufSize, size_t *puSize)
 Convert a date to a string. More...
 
uint16_t rdm_dateWeek (RDM_PACKED_DATE_T dt)
 Get the week of the year. More...
 
int32_t rdm_dateYear (RDM_PACKED_DATE_T dt)
 Get the year. More...
 
RDM_PACKED_DATE_T rdm_dateZero (void)
 Get the date of the epoch. More...
 

Detailed Description

The RDM date datatype API. The functions here are located in RDM Base Functionality. Linker option:

    -lrdmbase

Macro Definition Documentation

◆ RDM_DATE_MAX

#define RDM_DATE_MAX   RDM_UINT32_MAX

#include <rdmdateapi.h>

Function Documentation

◆ rdm_dateDayAbr()

const char* rdm_dateDayAbr ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the day abbreviation.

Get the three letter day abbreviation in English from a packed date.

Returns
The day abbreviation
Parameters
[in]dtRDM date value

◆ rdm_dateDayName()

const char* rdm_dateDayName ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the day name.

Get the day name in English from a packed date.

Returns
The day name
Parameters
[in]dtRDM date value

◆ rdm_dateDayOfMonth()

uint16_t rdm_dateDayOfMonth ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the day of the month.

Get the day of month from a packed date.

Returns
The day of month (1 - 31)
Parameters
[in]dtRDM packed date value

◆ rdm_dateDayOfWeek()

uint16_t rdm_dateDayOfWeek ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the day of the week.

Get the day of week from a packed date for a US locale where Sunday is the first day of the week.

Returns
The day of month (1 - 7)
Parameters
[in]dtRDM packed date value

◆ rdm_dateDayOfYear()

uint16_t rdm_dateDayOfYear ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the day of the year.

Get the day of year from a packed date where January 1st is the first day.

Returns
The day of the year (1 - 366)
Parameters
[in]dtRDM packed date value

◆ rdm_dateFromString()

RDM_RETCODE rdm_dateFromString ( const char *  str,
RDM_DATE_FORMAT  date_fmt,
RDM_PACKED_DATE_T pdv 
)

#include <rdmdateapi.h>

Convert from a string to a date.

Convert a string to a packed date.

Return values
sOKAYNormal, successful return.
eBASE_INVDATEInvalid date value.
eINVDATEFMTInvalid date format.
Parameters
[in]strThe date as a string that is to be converted
[in]date_fmtThe date format
[out]pdvRDM packed date value. The buffer need to be allocated by the caller.
Examples
c-core/14_core/core14Example_main.c.

◆ rdm_dateMonth()

uint16_t rdm_dateMonth ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the month.

Get the month from a packed date.

Returns
The month (1 - 12)
Parameters
[in]dtRDM packed date value

◆ rdm_dateMonthAbr()

const char* rdm_dateMonthAbr ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the month abbreviation.

Get the three letter month abbreviation in English.

Returns
The month abbreviation
Parameters
[in]dtRDM date value

◆ rdm_dateMonthName()

const char* rdm_dateMonthName ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the month name.

Get the month name in English from a packed date.

Returns
The month name
Parameters
[in]dtRDM date value

◆ rdm_dateNowAsString()

RDM_RETCODE rdm_dateNowAsString ( int16_t  time_zone,
char *  datebuf,
size_t  buflen 
)

#include <rdmdateapi.h>

Get the current date as a string.

Get the current local date as a string.

Return values
sOKAYNormal, successful return.
eBASE_INVTIMEZONEInvalid time zone value.
See also
rdm_dateToday
Parameters
[in]time_zonelocal timezone (in min)
[out]datebufNOW value in string
[in]buflensize of datebuf in number of ASCII characters it can hold

◆ rdm_dateQuarter()

uint16_t rdm_dateQuarter ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the quarter of the year.

Get the quarter of the year from a packed date.

Returns
The quarter of the year (1 - 4)
Parameters
[in]dtRDM packed date value

◆ rdm_dateToday()

RDM_RETCODE rdm_dateToday ( int16_t  time_zone,
RDM_PACKED_DATE_T pdt 
)

#include <rdmdateapi.h>

Get the current date.

Get the current date based for a time zone.

Return values
sOKAYNormal, successful return.
eBASE_INVTIMEZONEInvalid time zone value.
See also
rdm_dateNowAsString
Parameters
[in]time_zonelocal timezone value (in min)
[out]pdtcurrent date adjusted with time_zone
Examples
c-core/07_core/core07Example_main.c, and c-core/14_core/core14Example_main.c.

◆ rdm_dateToString()

RDM_RETCODE rdm_dateToString ( RDM_PACKED_DATE_T  dateVal,
RDM_DATE_FORMAT  date_fmt,
char  date_sep,
char *  buf,
size_t  bufSize,
size_t *  puSize 
)

#include <rdmdateapi.h>

Convert a date to a string.

Convert a packed date to a string.

Return values
sOKAYNormal, successful return.
eBASE_INVDATEInvalid date value.
eINVDATESEPInvalid date separator.
sTRUNCATEResult is truncated.
Parameters
[in]dateValRDM date value
[in]date_fmtRDM date format
[in]date_sepdate separator
[out]bufresulting date string
[in]bufSizebuffer size in number of ASCII characters it can hold
[out]puSizeresulting size in number of characters
Examples
c-core/07_core/core07Example_main.c, and c-core/14_core/core14Example_main.c.

◆ rdm_dateWeek()

uint16_t rdm_dateWeek ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the week of the year.

Get the week of the year in US locale.

Returns
The week of the year (1 - 53)
Parameters
[in]dtRDM packed date value

◆ rdm_dateYear()

int32_t rdm_dateYear ( RDM_PACKED_DATE_T  dt)

#include <rdmdateapi.h>

Get the year.

Get the year from a packed date.

Returns
The year
Parameters
[in]dtRDM packed date value

◆ rdm_dateZero()

RDM_PACKED_DATE_T rdm_dateZero ( void  )

#include <rdmdateapi.h>

Get the date of the epoch.

Get the date of the epoch in packed date format.

Returns
The date of the epoch