Collaboration diagram for Date API:

Macros

#define RDM_DATE_MAXRDM_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] dt RDM 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] dt RDM 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] dt RDM 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] dt RDM 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] dt RDM 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
sOKAY Normal, successful return.
eBASE_INVDATE Invalid date value.
eINVDATEFMT Invalid date format.
Parameters
[in] str The date as a string that is to be converted
[in] date_fmt The date format
[out] pdv RDM packed date value. The buffer need to be allocated by the caller.
Examples
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] dt RDM 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] dt RDM 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] dt RDM 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
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
See also
rdm_dateToday
Parameters
[in] time_zone local timezone (in min)
[out] datebuf NOW value in string
[in] buflen size 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] dt RDM 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
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
See also
rdm_dateNowAsString
Parameters
[in] time_zone local timezone value (in min)
[out] pdt current date adjusted with time_zone
Examples
core07Example_main.c, and 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
sOKAY Normal, successful return.
eBASE_INVDATE Invalid date value.
eINVDATESEP Invalid date separator.
sTRUNCATE Result is truncated.
Parameters
[in] dateVal RDM date value
[in] date_fmt RDM date format
[in] date_sep date separator
[out] buf resulting date string
[in] bufSize buffer size in number of ASCII characters it can hold
[out] puSize resulting size in number of characters
Examples
core07Example_main.c, and 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] dt RDM 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] dt RDM 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