Back to Aurora Vision Library website

You are here: Start » Function Reference » System » Time » CurrentDateTime

CurrentDateTime


Header: STD.h
Namespace: avl
Module: FoundationLite

Returns a string containing the date time information in selected format and all of the date time data separately.

Syntax

void avl::CurrentDateTime
(
	const atl::String& inFormat,
	atl::String& outDateTimeString,
	avl::DateTime& outDateTime
)

Parameters

Name Type Default Description
Input value inFormat const String& \"%x %X\" Date time string format
Output value outDateTimeString String& Date time string
Output value outDateTime DateTime&

Description

inFormat string containing any combination of regular characters and special format specifiers. These format specifiers are replaced by the function to the corresponding values to represent the time. They all begin with a percentage (%) sign, and are:

specifier Replaced by Example
%aAbbreviated day of the week name *Thu
%AFull day of the week name * Thursday
%bAbbreviated month name *Aug
%BFull month name *August
%cDate and time representation *Thu Aug 23 14:55:02 2001
%dDay of the month (01-31)23
%HHour in 24h format (00-23)14
%IHour in 12h format (01-12)02
%jDay of the year (001-366)235
%mMonth as a decimal number (01-12)08
%MMinute (00-59)55
%pAM or PM designationPM
%SSecond (00-61)02
%UWeek number with the first Sunday as the first day of week one (00-53)33
%wDay of the week as a decimal number with Sunday as 0 (0-6)4
%WWeek number with the first Monday as the first day of week one (00-53)34
%xDate representation *08/23/01
%XTime representation *14:55:02
%yYear, last two digits (00-99)01
%YYear2001
%ZTimezone name or abbreviationCDT
%zTimezone offset in ±HHMM format+0200
%%A % sign%

* The specifiers whose description is marked with an asterisk (*) are locale-dependent.

The other parameters are calendar date and time broken down into its components as integers.

Name Meaning Range
outDateTime.MillisecondsMilliseconds[0-999]
outDateTime.SecondsSeconds[0-60] *
outDateTime.MinutesMinutes[0-59]
outDateTime.HourHour in 24h format[0-23]
outDateTime.DayOfMonthDay of the month[1-31]
outDateTime.MonthMonth as a decimal number[1-12]
outDateTime.YearYear
outDateTime.DayOfWeekDay of the week as a decimal number with Sunday as 0[0-6]
outDateTime.DayOfYearDay of the year[1-366]
outDateTime.TimezoneOffsetOffset relative to UTC in seconds (negative value for positive time zone).
outDateTime.DaylightSavingWhether current local time is subject to Daylight Saving.
outDateTime.UnixTimeNumber of seconds that have elapsed since the Unix epoch.

* Number of seconds is usually in range [0-59], value 60 is only present because of leap seconds.

Errors

List of possible exceptions:

Error type Description
DomainError Incorrect date time format