AceTime  3.0.0
Date and time classes for Arduino that support timezones from the TZ Database.
Public Member Functions | Static Public Attributes | List of all members
ace_time::DateStrings Class Reference

Class that translates a numeric month (1-12) or dayOfWeek (1-7) into a human readable string. More...

#include <DateStrings.h>

Public Member Functions

const char * monthLongString (uint8_t month)
 Return the long month name. More...
 
const char * monthShortString (uint8_t month)
 Return the short month name. More...
 
const char * dayOfWeekLongString (uint8_t dayOfWeek)
 Return the short dayOfWeek name. More...
 
const char * dayOfWeekShortString (uint8_t dayOfWeek)
 Return the short dayOfWeek name. More...
 

Static Public Attributes

static const uint8_t kBufferSize = 10
 Length of the longest month or week name, including the '\0' terminator.
 
static const uint8_t kShortNameLength = 3
 Number of prefix characters to use to create a short name. More...
 

Detailed Description

Class that translates a numeric month (1-12) or dayOfWeek (1-7) into a human readable string.

Both long and short versions can be retrieved. The object uses an internal char[] buffer to store the result strings, so the strings must be used before DateStrings object is destroyed. This also means that the object is not thread-safe but Arduino boards are single-threaded currently so we don't have to worry about this.

Inspired by the DateStrings.cpp file in https://github.com/PaulStoffregen/Time/blob/master/DateStrings.cpp.

Definition at line 26 of file DateStrings.h.

Member Function Documentation

◆ dayOfWeekLongString()

const char* ace_time::DateStrings::dayOfWeekLongString ( uint8_t  dayOfWeek)
inline

Return the short dayOfWeek name.

0=Error, 1=Monday, 7=Sunday.

Definition at line 56 of file DateStrings.h.

◆ dayOfWeekShortString()

const char* ace_time::DateStrings::dayOfWeekShortString ( uint8_t  dayOfWeek)
inline

Return the short dayOfWeek name.

0=Err, 1=Mon, 7=Sun.

Definition at line 64 of file DateStrings.h.

◆ monthLongString()

const char* ace_time::DateStrings::monthLongString ( uint8_t  month)
inline

Return the long month name.

0=Error, 1=January, 12=December.

Definition at line 40 of file DateStrings.h.

◆ monthShortString()

const char* ace_time::DateStrings::monthShortString ( uint8_t  month)
inline

Return the short month name.

0=Err, 1=Jan, 12=Dec.

Definition at line 48 of file DateStrings.h.

Member Data Documentation

◆ kShortNameLength

const uint8_t ace_time::DateStrings::kShortNameLength = 3
static

Number of prefix characters to use to create a short name.

kShortNameLength < kBufferSize must be true.

Definition at line 37 of file DateStrings.h.


The documentation for this class was generated from the following files: