BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlt::DatetimeUtil Struct Reference

#include <bdlt_datetimeutil.h>

Detailed Description

This utility struct provides a namespace for a suite of functions operating on objects of type Datetime.

See bdlt_datetimeutil

Static Public Member Functions

static int convertFromTm (Datetime *result, const bsl::tm &timeStruct)
 
static bsl::tm convertToTm (const Datetime &datetime)
 
static void convertToTm (bsl::tm *result, const Datetime &datetime)
 
static bsl::optional< DatetimefromYmdHms (int year, int month, int day, int hour, int minute, int second, int millisecond=0, int microsecond=0)
 

Member Function Documentation

◆ convertFromTm()

int bdlt::DatetimeUtil::convertFromTm ( Datetime result,
const bsl::tm &  timeStruct 
)
inlinestatic

Load into the specified result the value of the specified timeStruct. Return 0 on success, and a non-zero value with no effect on result if timeStruct is invalid or otherwise cannot be represented as a Datetime. Values in fields tm_wday, tm_yday, and tm_isdst are ignored. The time 24:00:00 will be recognized, and leap seconds (i.e., values in tm_sec of 60 or 61) which can otherwise be represented as a Datetime will cause the conversion to succeed with the result "rolling over" into the zeroth second of next minute.

Note
Note that time zones are irrelevant for this conversion.

◆ convertToTm() [1/2]

void bdlt::DatetimeUtil::convertToTm ( bsl::tm *  result,
const Datetime datetime 
)
inlinestatic

◆ convertToTm() [2/2]

bsl::tm bdlt::DatetimeUtil::convertToTm ( const Datetime datetime)
inlinestatic

Return or load into the specified result the value of the specified datetime expressed as a bsl::tm. Each field in the result is set to its proper value except tm_isdst, which is set to -1 to indicate that no information on daylight saving time is available. A time value of 24:00:00:00 will be converted to 0:00:00.

Note
Note that time zones are irrelevant for this conversion.

◆ fromYmdHms()

bsl::optional< Datetime > bdlt::DatetimeUtil::fromYmdHms ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond = 0,
int  microsecond = 0 
)
inlinestatic

Return an optional having a Datetime with the specified year, month, day, hour, minute, second, and the optionally specified millisecond and microsecond, if those form a valid Datetime (see Datetime::isValid); otherwise return an optional without a value.


The documentation for this struct was generated from the following file: