Qore Programming Language Reference Manual  1.12.1
Date and Time Functions

Functions

int Qore::clock_getmicros ()
 Returns an integer representing the system time in microseconds (1/1000000 second intervals) since Jan 1, 1970 00:00:00Z. More...
 
int Qore::clock_getmillis ()
 Returns an integer representing the system time in milliseconds (1/1000 second intervals since Jan 1, 1970 00:00) More...
 
int Qore::clock_getnanos ()
 Returns an integer representing the system time in nanoseconds (1/1000000000 second intervals) since Jan 1, 1970 00:00:00Z. More...
 
date Qore::date (date dt)
 Returns the date passed. More...
 
date Qore::date (string dtstr)
 Converts the argument to a date and returns the date. More...
 
date Qore::date (softfloat f)
 The argument is assumed to be the number of seconds and fractions of a second. More...
 
date Qore::date (int i)
 The argument is assumed to be the number of seconds. More...
 
date Qore::date ()
 This function just returns 1970-01-01Z. More...
 
date Qore::date (null null)
 This function just returns 1970-01-01Z. More...
 
date Qore::date (string dtstr, string mask)
 Returns the date/time value corresponding to parsing a string argument according to a format mask. More...
 
hash< DateTimeInfoQore::date_info (date dt)
 Returns a DateTimeInfo hash for the given date argument (can be either a relative or absolute date) More...
 
hash< DateTimeInfoQore::date_info ()
 Returns a DateTimeInfo hash for the current date and time. More...
 
date Qore::date_ms (softint ms)
 Converts an integer argument representing the offset in milliseconds from January 1, 1970 in the local time zone to a date in the local time zone. More...
 
nothing Qore::date_ms ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::date_us (softint us)
 Converts an integer argument representing the offset in microseconds from January 1, 1970 in the local time zone to a date in the local time zone. More...
 
date Qore::days (softint days)
 Returns a relative date/time value in days based on the integer argument passed to be used in date arithmetic. More...
 
nothing Qore::days ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::format_date (string format, date dt)
 Returns a formatted string for a date argument passed. More...
 
nothing Qore::format_date ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::getDateFromISOWeek (softint year, softint week, softint day=1)
 Retuns an absolute date value for the ISO-8601 calendar week information passed (year, week number, optional: weekday, where 1=Monday, 7=Sunday) in the current time zone. More...
 
int Qore::getDayNumber (date dt)
 Returns an integer representing the ordinal day number in the year (corresponding to the ISO-8601 day number) for the absolute date value passed. More...
 
nothing Qore::getDayNumber ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::getDayOfWeek (date dt)
 Returns an integer representing the day of the week for the absolute date value passed (0=Sunday, 6=Saturday) More...
 
nothing Qore::getDayOfWeek ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::getISODayOfWeek (date dt)
 Returns an integer representing the ISO-8601 day of the week for the absolute date value passed (1=Monday, 7=Sunday) More...
 
nothing Qore::getISODayOfWeek ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
hash< IsoWeekInfoQore::getISOWeekHash (date dt)
 Returns an IsoWeekInfo hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: "year", "week", "day") More...
 
nothing Qore::getISOWeekHash ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::getISOWeekString (date dt)
 Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7") More...
 
nothing Qore::getISOWeekString ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::get_date_from_iso_week (softint year, softint week, softint day=1)
 Retuns an absolute date value for the ISO-8601 calendar week information passed (year, week number, optional: weekday, where 1=Monday, 7=Sunday) in the current time zone. More...
 
int Qore::get_day_number (date dt)
 Returns an integer representing the ordinal day number in the year (corresponding to the ISO-8601 day number) for the absolute date value passed. More...
 
int Qore::get_day_of_week (date dt)
 Returns an integer representing the day of the week for the absolute date value passed (0=Sunday, 6=Saturday) More...
 
int Qore::get_days (date dt)
 Returns an integer corresponding to the literal day value in the date (does not calculate a duration) More...
 
nothing Qore::get_days ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_duration_microseconds (date dt)
 Returns an integer value representing the the number of microseconds of duration in the value of the date passed (can be either a relative or absolute date) More...
 
int Qore::get_duration_milliseconds (date dt)
 Returns an integer value representing the the number of milliseconds of duration in the value of the date passed (can be either a relative or absolute date) More...
 
int Qore::get_duration_seconds (date dt)
 Returns an integer value representing the the number of seconds of duration in the value of the date passed (can be either a relative or absolute date) More...
 
float Qore::get_duration_seconds_f (date dt)
 Returns a floating-point value representing the the number of seconds of duration in the value of the date passed (can be either a relative or absolute date) More...
 
int Qore::get_epoch_seconds (date dt)
 Returns the number of seconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC); negative values are returned for dates before the epoch. More...
 
nothing Qore::get_epoch_seconds ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_hours (date dt)
 Returns an integer corresponding to the literal hour value in the date (does not calculate a duration) More...
 
nothing Qore::get_hours ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_iso_day_of_week (date dt)
 Returns an integer representing the ISO-8601 day of the week for the absolute date value passed (1=Monday, 7=Sunday) More...
 
hash< IsoWeekInfoQore::get_iso_week_hash (date dt)
 Returns an IsoWeekInfo hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: "year", "week", "day") More...
 
string Qore::get_iso_week_string (date dt)
 Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7") More...
 
int Qore::get_microseconds (date dt)
 Returns an integer corresponding to the literal microsecond value in the date (does not calculate a duration) More...
 
date Qore::get_midnight (date dt)
 Returns midnight on the date passed (strips the time component on the new value) More...
 
nothing Qore::get_midnight ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_milliseconds (date dt)
 Returns an integer corresponding to the literal millisecond value in the date (does not calculate a duration) More...
 
nothing Qore::get_milliseconds ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_minutes (date dt)
 Returns an integer corresponding to the literal minute value in the date (does not calculate a duration) More...
 
nothing Qore::get_minutes ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_months (date dt)
 Returns an integer corresponding to the literal month value in the date (does not calculate a duration) More...
 
nothing Qore::get_months ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_seconds (date dt)
 Returns an integer corresponding to the literal second value in the date (does not calculate a duration) More...
 
nothing Qore::get_seconds ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::get_years (date dt)
 Returns an integer corresponding to the literal year value in the date (does not calculate a duration) More...
 
nothing Qore::get_years ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::gmtime ()
 Returns the current UTC (GMT) time with a resolution of a second. More...
 
date Qore::gmtime (softint secs, softint us=0)
 Returns a date/time value in UTC (GMT) from arguments giving the number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC) More...
 
date Qore::gmtime (date dt)
 Returns the date and time in UTC (GMT) corresponding to the date argument passed. More...
 
date Qore::hours (softint hours)
 Returns a relative date/time value in hours based on the integer argument passed to be used in date arithmetic. More...
 
nothing Qore::hours ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
bool Qore::is_date_absolute (date dt)
 Returns True if the argument is an absolute date/time value, False if not. More...
 
bool Qore::is_date_absolute ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
bool Qore::is_date_relative (date dt)
 Returns True if the argument is an relative date/time value, False if not. More...
 
bool Qore::is_date_relative ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::localtime ()
 Returns the current date and time with a resolution to the second. More...
 
date Qore::localtime (softint secs, softint us=0)
 Returns the date and time in the local time zone corresponding to the integer arguments passed, which are interpreted as the number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC) More...
 
date Qore::localtime (date dt)
 Returns the date and time in the local time zone corresponding to the date argument passed. More...
 
date Qore::microseconds (softint us)
 Returns a relative date/time value in microseconds based on the integer argument passed to be used in date arithmetic. More...
 
date Qore::milliseconds (softint ms)
 Returns a relative date/time value in milliseconds based on the integer argument passed to be used in date arithmetic. More...
 
nothing Qore::milliseconds ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::minutes (softint minutes)
 Returns a relative date/time value in minutes based on the integer argument passed to be used in date arithmetic. More...
 
nothing Qore::minutes ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::mktime (date dt)
 Returns the number of seconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC); negative values are returned for dates before the epoch. More...
 
nothing Qore::mktime ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::months (softint months)
 Returns a relative date/time value in months based on the integer argument passed to be used in date arithmetic. More...
 
nothing Qore::months ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::now ()
 Returns the current date and time with a resolution to the second. More...
 
date Qore::now_ms ()
 Returns the current date and time with a resolution to the millisecond. More...
 
date Qore::now_us ()
 Returns the current date and time with a resolution to the microsecond. More...
 
date Qore::now_utc ()
 Returns the current UTC date and time with a resolution to the microsecond. More...
 
date Qore::seconds (softint seconds)
 Returns a relative date/time value in seconds based on the integer argument passed to be used in date arithmetic. More...
 
nothing Qore::seconds ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::timegm (date dt)
 Returns the number of seconds since January 1, 1970 00:00:00 in the local time zone for the given date. More...
 
nothing Qore::timegm ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
date Qore::years (softint years)
 Returns a relative date/time value in years based on the integer argument passed to be used in date arithmetic. More...
 
nothing Qore::years ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 

Detailed Description

Date Formatting Codes

Format Code Description
YY last two digits of year
YYYY four-digit year
M non zero-padded month number (1-12)
MM zero-padded two-digit month number (01-12)
Month long month string (ex: "January")
MONTH long month string capitalized (ex: "JANUARY")
Mon abbreviated month (ex: "Jan")
MON abbreviated month, capitalized (ex: "JAN")
D non zero-padded day number (1 - 31)
DD zero-padded day number (01 - 31)
Day long day of week string (ex: "Monday")
DAY long day of week string, capitalized (ex: "MONDAY")
Dn the ordinal day number in the year without zero padding ("1" - "366" for leap years; ex: "85")
DN the day number in the year with zero padding to 3 digits ("001" - "366" for leap years; ex: "085")
Dy abbreviated day of week string (ex: "Mon")
DY abbreviated day of week string capitalized (ex: "MON")
H non zero-padded hour number (0 - 23)
HH zero-padded hour number (00 - 23)
h non zero-padded hour number, 12-hour clock (1 - 12)
hh zero-padded hour number, 12-hour clock (01 - 12)
I the ISO-8601 week string for the date (ex: "2018-W12-5")
Id the ISO-8601 week day number in the week ("1" - "7")
ID the ISO-8601 week day number in the week ("1" - "7")
IF the value in ISO-8601 format for both relative (ex: "P2Y1M3DT5H7M9.002S") and absolute dates (ex: "2018-03-23T10:43:12.067628+01:00")
Iw the ISO-8601 week number for the year without zero padding ("1" - "53")
IW the ISO-8601 week number for the year with zero padding to 2 digits ("01" - "53")
Iy the ISO-8601 week year number without zero padding (ex: "2018")
IY the ISO-8601 week year number with zero padding to 4 digits (ex: "2018")
m non zero-padded minute number (0 - 59)
mm zero-padded minute number (00 - 59)
S non zero-padded second number (0 - 59)
SS zero-padded second number (00 - 59)
P "AM" or "PM" (upper-case)
p "am" or "pm" (lower-case)
u non zero-padded millisecond number (0 - 999)
uu or ms zero-padded millisecond number (000 - 999)
x non zero-padded microsecond number (0 - 999999)
xx or us zero-padded microsecond number (000000 - 999999)
y microseconds, with trailing zeros removed (suitable for use after the '.')
z local time zone name (ex: "EST") if available, otherwise the UTC offset (ex: "+01:00")
Z time zone UTC offset like +HH:mm[:SS] (ex: "+01:00"), seconds are only included if non-zero
Since
  • us was added in Qore 0.8.7
  • Dn, DN, I, Id, ID, IF, Iw, IW, Iy, IY format codes were added in Qore 0.9
Bug:
the "u" and "uu" format codes work with milliseconds and not microseconds since they were implemented before qore supported microsecond time resolution; this cannot be changed without breaking backwards-compatibility

Date Mask Format

The date mask (as used in Qore::date(string, string) and Qore::TimeZone::date(string, string)) is used to specify the string format of a date/time value for parsing to a date/time value.

The fields in the mask string are as follows:

Bug:
currently only English month abbreviations are accepted in the date/time mask

Function Documentation

◆ clock_getmicros()

int Qore::clock_getmicros ( )

Returns an integer representing the system time in microseconds (1/1000000 second intervals) since Jan 1, 1970 00:00:00Z.

Returns
an integer representing the system time in microseconds (1/1000000 second intervals) since Jan 1, 1970 00:00:00Z
Code Flags:
CONSTANT
Example:
int us = clock_getmicros();
int clock_getmicros()
Returns an integer representing the system time in microseconds (1/1000000 second intervals) since Ja...
See also

◆ clock_getmillis()

int Qore::clock_getmillis ( )

Returns an integer representing the system time in milliseconds (1/1000 second intervals since Jan 1, 1970 00:00)

Returns
an integer representing the system time in milliseconds (1/1000 second intervals since Jan 1, 1970 00:00)
Code Flags:
CONSTANT
Example:
int ms = clock_getmillis();
int clock_getmillis()
Returns an integer representing the system time in milliseconds (1/1000 second intervals since Jan 1,...
See also

◆ clock_getnanos()

int Qore::clock_getnanos ( )

Returns an integer representing the system time in nanoseconds (1/1000000000 second intervals) since Jan 1, 1970 00:00:00Z.

Returns
an integer representing the system time in nanoseconds (1/1000000000 second intervals) since Jan 1, 1970 00:00:00Z
Code Flags:
CONSTANT
Example:
int ns = clock_getnanos();
int clock_getnanos()
Returns an integer representing the system time in nanoseconds (1/1000000000 second intervals) since ...
See also

◆ date() [1/7]

date Qore::date ( )

This function just returns 1970-01-01Z.

Code Flags:
CONSTANT

This function is included because the date() function is used to convert values to dates (similar to a C/C++ cast)

Returns
1970-01-01Z

◆ date() [2/7]

date Qore::date ( date  dt)

Returns the date passed.

This function is included because the date() function is used to convert values to dates (similar to a C/C++ cast)

Code Flags:
CONSTANT
Parameters
dtthe date to return
Returns
the date passed

◆ date() [3/7]

date Qore::date ( int  i)

The argument is assumed to be the number of seconds.

Code Flags:
CONSTANT
Parameters
ithe number of seconds
Returns
a relative date/time value corresponding to the number of seconds
Example:
date d = date(i);
date date(date dt)
Returns the date passed.
Since
Qore 0.8.13 the return value is a relative date/time value in seconds

◆ date() [4/7]

date Qore::date ( null  null)

This function just returns 1970-01-01Z.

Code Flags:
CONSTANT

This function is included because the date() function is used to convert values to dates (similar to a C/C++ cast)

Returns
1970-01-01Z

◆ date() [5/7]

date Qore::date ( softfloat  f)

The argument is assumed to be the number of seconds and fractions of a second.

Code Flags:
CONSTANT
Parameters
fthe number of seconds and fractions of a second
Returns
a relative date/time value corresponding to the number of seconds and fractions of a second in the argument
Example:
date d = date(f);
Since
Qore 0.8.13 the return value is a relative date/time value in seconds

◆ date() [6/7]

date Qore::date ( string  dtstr)

Converts the argument to a date and returns the date.

Code Flags:
CONSTANT
Parameters
dtstrstring a string to bo converted literally to an absolute date/time value; if no time zone information is present, the local time zone is assumed
Returns
the absolute date/time value corresponding to the string argument passed
Example:
date d = date("2001-01-01T15:35:23"); # returns 2001-01-01 15:35:23 Mon +01:00 (CET)
date d = date("20010101 15:35:23Z"); # returns 2001-01-01 15:35:23 Mon Z (UTC)
date d = date("20010101 153523Z"); # returns 2001-01-01 15:35:23 Mon Z (UTC)
date d = date("20010101 153523-02"); # returns 2001-01-01 15:35:23 Mon -02:00 (-02:00)
date d = date("20010101 153523-02:00:00"); # returns 2001-01-01 15:35:23 Mon -02:00 (-02:00)
date d = date("2001-01-01-153523-020000"); # returns 2001-01-01 15:35:23 Mon -02:00 (-02:00)
date d = date("20010101-153523"); # returns 2001-01-01 15:35:23 Mon +01:00 (CET)
Exceptions
INVALID-DATEthrown if the date is invalid; invalid or missing date components
See also
date(string, string)
Since
Qore 0.8.12.4 INVALID-DATE exceptions are thrown if the date is invalid

◆ date() [7/7]

date Qore::date ( string  dtstr,
string  mask 
)

Returns the date/time value corresponding to parsing a string argument according to a format mask.

Code Flags:
RET_VALUE_ONLY
Parameters
dtstra string giving a date
maskthe mask for the date value; see Date Mask Format for information on the format of the format mask
Returns
the date/time value corresponding to parsing the dtstr string argument according to mask serving as a format mask
Example:
date dt = date("20100401 234520 230394", "YYYYMMDD HHmmSS ssssss"); # returns 2010-04-01T23:45:20.230394
Exceptions
INVALID-DATEinvalid mask specification
See also
Qore::TimeZone::date(string, string) for a method that allows the date to be parsed in a particular time zone

◆ date_info() [1/2]

hash<DateTimeInfo> Qore::date_info ( )

Returns a DateTimeInfo hash for the current date and time.

Returns
a DateTimeInfo hash for the current date and time
Code Flags:
CONSTANT
Example:
hash<DateTimeInfo> h = date_info();
hash< DateTimeInfo > date_info(date dt)
Returns a DateTimeInfo hash for the given date argument (can be either a relative or absolute date)

◆ date_info() [2/2]

hash<DateTimeInfo> Qore::date_info ( date  dt)

Returns a DateTimeInfo hash for the given date argument (can be either a relative or absolute date)

Code Flags:
CONSTANT
Parameters
dtthe date to return information for
Returns
a DateTimeInfo hash for the given date argument
Example:
hash<DateTimeInfo> h = date_info(date);
Note
equivalent to <date>::info()

◆ date_ms() [1/2]

nothing Qore::date_ms ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ date_ms() [2/2]

date Qore::date_ms ( softint  ms)

Converts an integer argument representing the offset in milliseconds from January 1, 1970 in the local time zone to a date in the local time zone.

Code Flags:
CONSTANT
Parameters
msan integer argument representing the offset in milliseconds from January 1, 1970 in the local time zone
Returns
a date in the local time zone corresponding to the argument passed which is an offset in milliseconds from January 1, 1970 in the local time zone
Example:
date date = date_ms(1); # returns 1970-01-01T00:00:00.001 in the local time zone
date date_ms(softint ms)
Converts an integer argument representing the offset in milliseconds from January 1,...
See also
date_us(softint)

◆ date_us()

date Qore::date_us ( softint  us)

Converts an integer argument representing the offset in microseconds from January 1, 1970 in the local time zone to a date in the local time zone.

Code Flags:
CONSTANT
Parameters
usan integer argument representing the offset in microseconds from January 1, 1970 in the local time zone
Returns
a date in the local time zone corresponding to the argument passed which is an offset in microseconds from January 1, 1970 in the local time zone
Example:
date date = date_us(1); # returns 1970-01-01T00:00:00.000001 in the local time zone
date date_us(softint us)
Converts an integer argument representing the offset in microseconds from January 1,...
See also
date_ms(softint)

◆ days() [1/2]

nothing Qore::days ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ days() [2/2]

date Qore::days ( softint  days)

Returns a relative date/time value in days based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
daysthe number of days to return
Returns
a relative date/time value in days based on the integer argument passed to be used in date arithmetic
Example:
date rd = days(100);
date days(softint days)
Returns a relative date/time value in days based on the integer argument passed to be used in date ar...
See also

◆ format_date() [1/2]

nothing Qore::format_date ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ format_date() [2/2]

string Qore::format_date ( string  format,
date  dt 
)

Returns a formatted string for a date argument passed.

Code Flags:
CONSTANT
Parameters
formata string giving the format for the date; see Date Formatting Codes for more information about this string
dtthe date to use for the string output
Returns
a formatted string for a date argument passed
Example:
string str = format_date("Day, Mon D, YYYY-MM-DD HH:mm:SS", 2004-02-01T12:30:00);
# returns "Sunday, Feb 1, 2004-02-01 12:30:00"
string format_date(string format, date dt)
Returns a formatted string for a date argument passed.
Bug:
there is no locale support; day and month names and abbreviations are only returned in English

◆ get_date_from_iso_week()

date Qore::get_date_from_iso_week ( softint  year,
softint  week,
softint  day = 1 
)

Retuns an absolute date value for the ISO-8601 calendar week information passed (year, week number, optional: weekday, where 1=Monday, 7=Sunday) in the current time zone.

Throws an exception if the arguments are invalid

Code Flags:
RET_VALUE_ONLY
Parameters
yearthe ISO-8601 year (which for some special days does not always correspond to the actual calendar year)
weekthe ISO-8601 week number; if this argument is invalid, an ISO-8601-INVALID-WEEK exception is thrown
daythe day of the week, where 1=Monday and 7=Sunday; if this argument is invalid, an ISO-8601-INVALID-DAY exception is thrown
Returns
an absolute date value for the ISO-8601 calendar week information passed (year, week number, optional: weekday, where 1=Monday, 7=Sunday) in the current time zone
Example:
date d = getDateFromISOWeek(2007, 3); # returns 2007-01-15
date getDateFromISOWeek(softint year, softint week, softint day=1)
Retuns an absolute date value for the ISO-8601 calendar week information passed (year,...
Exceptions
ISO-8601-INVALID-WEEKThe week number is not valid for the given year
ISO-8601-INVALID-DAYThe day number is not between 1 (Monday) and 7 (Sunday) inclusive
Since
Qore 0.8.12 as a replacement for deprecated camel-case getDateFromISOWeek()

◆ get_day_number()

int Qore::get_day_number ( date  dt)

Returns an integer representing the ordinal day number in the year (corresponding to the ISO-8601 day number) for the absolute date value passed.

Code Flags:
CONSTANT
Parameters
dtan absolute date value to get the ordinal day number
Returns
an integer representing the ordinal day number in the year (corresponding to the ISO-8601 day number) for the absolute date value passed; if a relative date value is passed, then this function will return 0
Example:
int dn = get_day_number(dt);
int get_day_number(date dt)
Returns an integer representing the ordinal day number in the year (corresponding to the ISO-8601 day...
Note
equivalent to <date>::dayNumber()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getDayNumber()

◆ get_day_of_week()

int Qore::get_day_of_week ( date  dt)

Returns an integer representing the day of the week for the absolute date value passed (0=Sunday, 6=Saturday)

Code Flags:
CONSTANT
Parameters
dtan absolute date value to get the number for the day of the week
Returns
an integer representing the day of the week for the absolute date value passed (0=Sunday, 6=Saturday); if a relative date value is passed, then this function will return 0
Example:
int dn = get_day_of_week(dt);
int get_day_of_week(date dt)
Returns an integer representing the day of the week for the absolute date value passed (0=Sunday,...
Note
equivalent to <date>::dayOfWeek()
See also
get_iso_day_of_week()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getDayOfWeek()

◆ get_days() [1/2]

nothing Qore::get_days ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_days() [2/2]

int Qore::get_days ( date  dt)

Returns an integer corresponding to the literal day value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the day value in the date
Example:
int n = get_days(dt);
int get_days(date dt)
Returns an integer corresponding to the literal day value in the date (does not calculate a duration)
Note
equivalent to pseudo-method <date>::days()

◆ get_duration_microseconds()

int Qore::get_duration_microseconds ( date  dt)

Returns an integer value representing the the number of microseconds of duration in the value of the date passed (can be either a relative or absolute date)

Code Flags:
CONSTANT
Parameters
dta relative or absolute date argument
Returns
an integer value representing the the number of microseconds of duration in the value of the date passed; if the argument is a relative date, the value is normalized to microseconds and the integer microseconds value is returned, if the argument is an absolute date, the duration in microseconds is calculated from the present time; so if the present time is sent as an argument, 0 is returned, if a future date is used, the number of microseconds from the present time to the future date is returned, if an absolute date in the past is passed as an argument, also 0 is returned (the function does not calculate microsecond differences for absolute dates in the past (for this use Date/Time Arithmetic instead); this function can only return a negative value if passed a relative date/time value
Example:
int us = get_duration_microseconds(PT2M15S3u); # returns 135000003
int get_duration_microseconds(date dt)
Returns an integer value representing the the number of microseconds of duration in the value of the ...
Note
See also

◆ get_duration_milliseconds()

int Qore::get_duration_milliseconds ( date  dt)

Returns an integer value representing the the number of milliseconds of duration in the value of the date passed (can be either a relative or absolute date)

The duration in milliseconds is calculated and any fractional milliseconds are truncated (no rounding is performed)

Code Flags:
CONSTANT
Parameters
dta relative or absolute date argument
Returns
an integer value representing the the number of milliseconds of duration in the value of the date passed; if the argument is a relative date, the value is normalized to milliseconds and the integer milliseconds value is returned, if the argument is an absolute date, the duration in milliseconds is calculated from the present time; so if the present time is sent as an argument, 0 is returned, if a future date is used, the number of milliseconds from the present time to the future date is returned, if an absolute date in the past is passed as an argument, also 0 is returned (the function does not calculate millisecond differences for absolute dates in the past (for this use Date/Time Arithmetic instead); this function can only return a negative value if passed a relative date/time value
Example:
int ms = get_duration_milliseconds(PT2M15S3u); # returns 135000
int get_duration_milliseconds(date dt)
Returns an integer value representing the the number of milliseconds of duration in the value of the ...
Note
See also

◆ get_duration_seconds()

int Qore::get_duration_seconds ( date  dt)

Returns an integer value representing the the number of seconds of duration in the value of the date passed (can be either a relative or absolute date)

The duration in seconds is calculated and any fractional seconds are truncated (no rounding is performed)

Code Flags:
CONSTANT
Parameters
dta relative or absolute date argument
Returns
an integer value representing the the number of seconds of duration in the value of the date passed; if the argument is a relative date, the value is normalized to seconds and the integer seconds value is returned, if the argument is an absolute date, the duration in seconds is calculated from the present time; so if the present time is sent as an argument, 0 is returned, if a future date is used, the number of seconds from the present time to the future date is returned, if an absolute date in the past is passed as an argument, also 0 is returned (the function does not calculate second differences for absolute dates in the past (for this use Date/Time Arithmetic instead); this function can only return a negative value if passed a relative date/time value
Example:
int us = get_duration_seconds(PT2M15S3u); # returns 135
int get_duration_seconds(date dt)
Returns an integer value representing the the number of seconds of duration in the value of the date ...
Note
See also

◆ get_duration_seconds_f()

float Qore::get_duration_seconds_f ( date  dt)

Returns a floating-point value representing the the number of seconds of duration in the value of the date passed (can be either a relative or absolute date)

The duration in seconds is calculated and any fractional seconds are returned as digits to the right of the decimal point.

Code Flags:
CONSTANT
Parameters
dta relative or absolute date argument
Returns
a floating-point value representing the the number of seconds of duration in the value of the date passed; if the argument is a relative date, the value is normalized to seconds and the floating-point seconds value is returned with microseconds providing the digits to the right of the decimal place, if the argument is an absolute date, the duration in seconds is calculated from the present time; so if the present time is sent as an argument, 0 is returned, if a future date is used, the number of seconds from the present time to the future date is returned, if an absolute date in the past is passed as an argument, also 0 is returned (the function does not calculate second differences for absolute dates in the past (for this use Date/Time Arithmetic instead); this function can only return a negative value if passed a relative date/time value
Example:
float dt = get_duration_seconds_f(PT2M15S3u); # returns 135.000003
float get_duration_seconds_f(date dt)
Returns a floating-point value representing the the number of seconds of duration in the value of the...
Note
See also
Since
Qore 0.8.12

◆ get_epoch_seconds() [1/2]

nothing Qore::get_epoch_seconds ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_epoch_seconds() [2/2]

int Qore::get_epoch_seconds ( date  dt)

Returns the number of seconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC); negative values are returned for dates before the epoch.

Code Flags:
CONSTANT
Parameters
dtThe date to process
Returns
the number of seconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC); negative values are returned for dates before the epoch
Example:
int i = get_epoch_seconds(2012-01-19T08:02:15+01:00);
int get_epoch_seconds(date dt)
Returns the number of seconds of the date and time in local time passed since Jan 1,...
See also
timegm(date)
Note
This function is equivalent to mktime(date)

◆ get_hours() [1/2]

nothing Qore::get_hours ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_hours() [2/2]

int Qore::get_hours ( date  dt)

Returns an integer corresponding to the literal hour value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the hour value in the date
Example:
int n = get_hours(dt);
int get_hours(date dt)
Returns an integer corresponding to the literal hour value in the date (does not calculate a duration...
Note
equivalent to pseudo-method <date>::hours()

◆ get_iso_day_of_week()

int Qore::get_iso_day_of_week ( date  dt)

Returns an integer representing the ISO-8601 day of the week for the absolute date value passed (1=Monday, 7=Sunday)

Code Flags:
CONSTANT
Parameters
dtan absolute date value to get the number for the day of the week
Returns
an integer representing the day of the week for the absolute date value passed (1=Monday, 7=Sunday); if a relative date value is passed, then this function will return 7
Example:
int dn = get_iso_day_of_week(dt);
int get_iso_day_of_week(date dt)
Returns an integer representing the ISO-8601 day of the week for the absolute date value passed (1=Mo...
Note
equivalent to <date>::isoDayOfWeek()
See also
get_day_of_week()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getISODayOfWeek()

◆ get_iso_week_hash()

hash<IsoWeekInfo> Qore::get_iso_week_hash ( date  dt)

Returns an IsoWeekInfo hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: "year", "week", "day")

Note
that the ISO-8601 year does not always correspond with the calendar year at the end and the beginning of every year (for example 2006-01-01 in ISO-8601 calendar week format is: year=2005, week=52, day=7)
Code Flags:
CONSTANT
Parameters
dtthe date to get information for
Returns
an IsoWeekInfo hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: "year", "week", "day"); if a relative date value is passed, then this function will return year=1970, week=1, day=1
Example:
hash<IsoWeekInfo> h = get_iso_week_hash(2007-05-15); # returns year=2007, week=20, day=2
hash< IsoWeekInfo > get_iso_week_hash(date dt)
Returns an IsoWeekInfo hash representing the ISO-8601 calendar week information for the absolute date...
Note
equivalent to <date>::isoWeekHash()
See also
get_iso_week_string()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getISOWeekHash()

◆ get_iso_week_string()

string Qore::get_iso_week_string ( date  dt)

Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7")

Code Flags:
CONSTANT
Parameters
dtthe date to get information for
Returns
a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7"); if a relative date value is passed, then this function will return "1970-W01-1"
Example:
string str = get_iso_week_string(2007-05-15); # returns "2007-W20-2"
string get_iso_week_string(date dt)
Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex...
Note
equivalent to <date>::isoWeekString()
See also
get_iso_week_hash()
Since
Qore 0.8.12 as a replacement for deprecated camel-case getISOWeekString()

◆ get_microseconds()

int Qore::get_microseconds ( date  dt)

Returns an integer corresponding to the literal microsecond value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the literal microsecond value in the date (does not calculate a duration)
Example:
int n = get_microseconds(dt);
int get_microseconds(date dt)
Returns an integer corresponding to the literal microsecond value in the date (does not calculate a d...
Note

◆ get_midnight() [1/2]

nothing Qore::get_midnight ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_midnight() [2/2]

date Qore::get_midnight ( date  dt)

Returns midnight on the date passed (strips the time component on the new value)

Code Flags:
CONSTANT
Parameters
dtthe date to process
Returns
midnight on the date passed (strips the time component on the new value)
Example:
date midnight = get_midnight(dt);
date get_midnight(date dt)
Returns midnight on the date passed (strips the time component on the new value)
Note
equivalent to pseudo-method <date>::midnight()

◆ get_milliseconds() [1/2]

nothing Qore::get_milliseconds ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_milliseconds() [2/2]

int Qore::get_milliseconds ( date  dt)

Returns an integer corresponding to the literal millisecond value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the literal millisecond value in the date (does not calculate a duration)
Example:
int n = get_milliseconds(dt);
int get_milliseconds(date dt)
Returns an integer corresponding to the literal millisecond value in the date (does not calculate a d...
Note

◆ get_minutes() [1/2]

nothing Qore::get_minutes ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_minutes() [2/2]

int Qore::get_minutes ( date  dt)

Returns an integer corresponding to the literal minute value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the minute value in the date
Example:
int n = get_minutes(dt);
int get_minutes(date dt)
Returns an integer corresponding to the literal minute value in the date (does not calculate a durati...
Note
equivalent to pseudo-method <date>::minutes()

◆ get_months() [1/2]

nothing Qore::get_months ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_months() [2/2]

int Qore::get_months ( date  dt)

Returns an integer corresponding to the literal month value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the month value in the date
Example:
int n = get_months(dt);
int get_months(date dt)
Returns an integer corresponding to the literal month value in the date (does not calculate a duratio...
Note
equivalent to pseudo-method <date>::months()

◆ get_seconds() [1/2]

nothing Qore::get_seconds ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_seconds() [2/2]

int Qore::get_seconds ( date  dt)

Returns an integer corresponding to the literal second value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the literal second value in the date (does not calculate a duration)
Example:
int n = get_seconds(dt);
int get_seconds(date dt)
Returns an integer corresponding to the literal second value in the date (does not calculate a durati...
Note

◆ get_years() [1/2]

nothing Qore::get_years ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ get_years() [2/2]

int Qore::get_years ( date  dt)

Returns an integer corresponding to the literal year value in the date (does not calculate a duration)

Code Flags:
CONSTANT
Parameters
dtthe date value; can be either a relative or absolute date
Returns
an integer corresponding to the year value in the date
Example:
int n = get_years(dt);
int get_years(date dt)
Returns an integer corresponding to the literal year value in the date (does not calculate a duration...
Note
equivalent to pseudo-method <date>::years()

◆ getDateFromISOWeek()

date Qore::getDateFromISOWeek ( softint  year,
softint  week,
softint  day = 1 
)

Retuns an absolute date value for the ISO-8601 calendar week information passed (year, week number, optional: weekday, where 1=Monday, 7=Sunday) in the current time zone.

Throws an exception if the arguments are invalid

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Parameters
yearthe ISO-8601 year (which for some special days does not always correspond to the actual calendar year)
weekthe ISO-8601 week number; if this argument is invalid, an ISO-8601-INVALID-WEEK exception is thrown
daythe day of the week, where 1=Monday and 7=Sunday; if this argument is invalid, an ISO-8601-INVALID-DAY exception is thrown
Returns
an absolute date value for the ISO-8601 calendar week information passed (year, week number, optional: weekday, where 1=Monday, 7=Sunday) in the current time zone
Exceptions
ISO-8601-INVALID-WEEKThe week number is not valid for the given year
ISO-8601-INVALID-DAYThe day number is not between 1 (Monday) and 7 (Sunday) inclusive
Deprecated:
use get_date_from_iso_week(); camel-case function names were deprecated in Qore 0.8.12

◆ getDayNumber() [1/2]

nothing Qore::getDayNumber ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED

◆ getDayNumber() [2/2]

int Qore::getDayNumber ( date  dt)

Returns an integer representing the ordinal day number in the year (corresponding to the ISO-8601 day number) for the absolute date value passed.

Code Flags:
CONSTANT, DEPRECATED
Parameters
dtan absolute date value to get the ordinal day number
Returns
an integer representing the ordinal day number in the year (corresponding to the ISO-8601 day number) for the absolute date value passed; if a relative date value is passed, then this function will return 0
Deprecated:
use get_day_number(); camel-case function names were deprecated in Qore 0.8.12

◆ getDayOfWeek() [1/2]

nothing Qore::getDayOfWeek ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED

◆ getDayOfWeek() [2/2]

int Qore::getDayOfWeek ( date  dt)

Returns an integer representing the day of the week for the absolute date value passed (0=Sunday, 6=Saturday)

Code Flags:
CONSTANT, DEPRECATED
Parameters
dtan absolute date value to get the number for the day of the week
Returns
an integer representing the day of the week for the absolute date value passed (0=Sunday, 6=Saturday); if a relative date value is passed, then this function will return 0
See also
get_iso_day_of_week()
Deprecated:
use get_day_of_week(); camel-case function names were deprecated in Qore 0.8.12

◆ getISODayOfWeek() [1/2]

nothing Qore::getISODayOfWeek ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED

◆ getISODayOfWeek() [2/2]

int Qore::getISODayOfWeek ( date  dt)

Returns an integer representing the ISO-8601 day of the week for the absolute date value passed (1=Monday, 7=Sunday)

Code Flags:
CONSTANT, DEPRECATED
Parameters
dtan absolute date value to get the number for the day of the week
Returns
an integer representing the day of the week for the absolute date value passed (1=Monday, 7=Sunday); if a relative date value is passed, then this function will return 7
See also
get_day_of_week()
Deprecated:
use get_iso_day_of_week(); camel-case function names were deprecated in Qore 0.8.12

◆ getISOWeekHash() [1/2]

nothing Qore::getISOWeekHash ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED

◆ getISOWeekHash() [2/2]

hash<IsoWeekInfo> Qore::getISOWeekHash ( date  dt)

Returns an IsoWeekInfo hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: "year", "week", "day")

Note
that the ISO-8601 year does not always correspond with the calendar year at the end and the beginning of every year (for example 2006-01-01 in ISO-8601 calendar week format is: year=2005, week=52, day=7)
Code Flags:
CONSTANT, DEPRECATED
Parameters
dtthe date to get information for
Returns
an IsoWeekInfo hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: "year", "week", "day"); if a relative date value is passed, then this function will return year=1970, week=1, day=1
See also
get_iso_week_string()
Deprecated:
use get_iso_week_hash(); camel-case function names were deprecated in Qore 0.8.12

◆ getISOWeekString() [1/2]

nothing Qore::getISOWeekString ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP, DEPRECATED

◆ getISOWeekString() [2/2]

string Qore::getISOWeekString ( date  dt)

Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7")

Code Flags:
CONSTANT, DEPRECATED
Parameters
dtthe date to get information for
Returns
a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7"); if a relative date value is passed, then this function will return "1970-W01-1"
Example:
string str = getISOWeekString(2007-05-15); # returns "2007-W20-2"
string getISOWeekString(date dt)
Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex...
See also
get_iso_week_hash()
Deprecated:
use get_iso_week_string(); camel-case function names were deprecated in Qore 0.8.12

◆ gmtime() [1/3]

date Qore::gmtime ( )

Returns the current UTC (GMT) time with a resolution of a second.

Returns
the current UTC (GMT) time with a resolution of a second
Code Flags:
CONSTANT
Example:
date utc = gmtime();
date gmtime()
Returns the current UTC (GMT) time with a resolution of a second.
See also

◆ gmtime() [2/3]

date Qore::gmtime ( date  dt)

Returns the date and time in UTC (GMT) corresponding to the date argument passed.

Code Flags:
CONSTANT
Parameters
dta date to process; if the date passed is already in UTC, then the same value is returned
Returns
the date and time in UTC (GMT) corresponding to the date argument passed
Example:
date dt = gmtime(2012-01-19T15:00:00-07:00);
See also
localtime(date)

◆ gmtime() [3/3]

date Qore::gmtime ( softint  secs,
softint  us = 0 
)

Returns a date/time value in UTC (GMT) from arguments giving the number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC)

Code Flags:
CONSTANT
Parameters
secsthe number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC)
usa microsecond offset for the time returned
Returns
a date/time value in UTC (GMT) from arguments giving the number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC)
Example:
date dt = gmtime(10);
See also
localtime(softint, softint)

◆ hours() [1/2]

nothing Qore::hours ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ hours() [2/2]

date Qore::hours ( softint  hours)

Returns a relative date/time value in hours based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
hoursthe number of hours to return
Returns
a relative date/time value in hours based on the integer argument passed to be used in date arithmetic
Example:
date rd = hours(100);
date hours(softint hours)
Returns a relative date/time value in hours based on the integer argument passed to be used in date a...
See also

◆ is_date_absolute() [1/2]

bool Qore::is_date_absolute ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ is_date_absolute() [2/2]

bool Qore::is_date_absolute ( date  dt)

Returns True if the argument is an absolute date/time value, False if not.

Code Flags:
CONSTANT
Parameters
dtthe date to check
Returns
True if the argument is an absolute date/time value, False if not
Example:
bool b = is_date_absolute(dt)
bool is_date_absolute(date dt)
Returns True if the argument is an absolute date/time value, False if not.
See also
is_date_relative()

◆ is_date_relative() [1/2]

bool Qore::is_date_relative ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ is_date_relative() [2/2]

bool Qore::is_date_relative ( date  dt)

Returns True if the argument is an relative date/time value, False if not.

Code Flags:
CONSTANT
Parameters
dtthe date to check
Returns
True if the argument is an relative date/time value, False if not
Example:
bool b = is_date_relative(dt)
bool is_date_relative(date dt)
Returns True if the argument is an relative date/time value, False if not.
See also
is_date_absolute()

◆ localtime() [1/3]

date Qore::localtime ( )

Returns the current date and time with a resolution to the second.

Returns
the current date and time with a resolution to the second
Code Flags:
CONSTANT
Example:
date d = localtime();
date localtime()
Returns the current date and time with a resolution to the second.
See also
gmtime()
Note
this variant of localtime() is equivalent to now()

◆ localtime() [2/3]

date Qore::localtime ( date  dt)

Returns the date and time in the local time zone corresponding to the date argument passed.

Code Flags:
CONSTANT
Parameters
dta date to process; if the date passed is in the local time zone, then the same value is returned
Returns
the date and time in the local time zone corresponding to the date argument passed
Example:
date dt = localtime(2012-01-19T15:00:00-07:00);
See also
gmtime(date)

◆ localtime() [3/3]

date Qore::localtime ( softint  secs,
softint  us = 0 
)

Returns the date and time in the local time zone corresponding to the integer arguments passed, which are interpreted as the number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC)

Code Flags:
CONSTANT
Parameters
secsthe number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC)
usa microsecond offset for the time returned
Returns
the date and time in the local time zone corresponding to the arguments passed
Example:
date dt = localtime(10);
See also
gmtime(softint, softint)

◆ microseconds()

date Qore::microseconds ( softint  us)

Returns a relative date/time value in microseconds based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
usthe number of microseconds to return
Returns
a relative date/time value in microseconds based on the integer argument passed to be used in date arithmetic
Example:
date rd = microseconds(100);
date microseconds(softint us)
Returns a relative date/time value in microseconds based on the integer argument passed to be used in...
See also

◆ milliseconds() [1/2]

nothing Qore::milliseconds ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ milliseconds() [2/2]

date Qore::milliseconds ( softint  ms)

Returns a relative date/time value in milliseconds based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
msthe number of milliseconds to return
Returns
a relative date/time value in milliseconds based on the integer argument passed to be used in date arithmetic
Example:
date rd = milliseconds(100);
date milliseconds(softint ms)
Returns a relative date/time value in milliseconds based on the integer argument passed to be used in...
See also

◆ minutes() [1/2]

nothing Qore::minutes ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ minutes() [2/2]

date Qore::minutes ( softint  minutes)

Returns a relative date/time value in minutes based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
minutesthe number of minutes to return
Returns
a relative date/time value in minutes based on the integer argument passed to be used in date arithmetic
Example:
date rd = minutes(100);
date minutes(softint minutes)
Returns a relative date/time value in minutes based on the integer argument passed to be used in date...
See also

◆ mktime() [1/2]

nothing Qore::mktime ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ mktime() [2/2]

int Qore::mktime ( date  dt)

Returns the number of seconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC); negative values are returned for dates before the epoch.

Code Flags:
CONSTANT
Parameters
dtThe date to process
Returns
the number of seconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC); negative values are returned for dates before the epoch
Example:
int i = mktime(2012-01-19T08:02:15+01:00);
int mktime(date dt)
Returns the number of seconds of the date and time in local time passed since Jan 1,...
See also
timegm(date)
Note
This function is equivalent to get_epoch_seconds(date)

◆ months() [1/2]

nothing Qore::months ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ months() [2/2]

date Qore::months ( softint  months)

Returns a relative date/time value in months based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
monthsthe number of months to return
Returns
a relative date/time value in months based on the integer argument passed to be used in date arithmetic
Example:
date rd = months(100);
date months(softint months)
Returns a relative date/time value in months based on the integer argument passed to be used in date ...
See also

◆ now()

date Qore::now ( )

Returns the current date and time with a resolution to the second.

Returns
the current date and time with a resolution to the second
Code Flags:
CONSTANT
Example:
date d = now();
date now()
Returns the current date and time with a resolution to the second.
See also
Note
this function is equivalent to localtime()

◆ now_ms()

date Qore::now_ms ( )

Returns the current date and time with a resolution to the millisecond.

Returns
the current date and time with a resolution to the millisecond
Code Flags:
CONSTANT
Example:
date d = now_ms();
date now_ms()
Returns the current date and time with a resolution to the millisecond.
See also
  • now() For a similar function returning the current date and time in the local time zone with coarser granularity, when resolution only to the second is needed
  • now_us() for a similar function returning the current date and time with a resolution to the microsecond
  • now_utc();
Note
There is no performance penalty for using now_ms() and now_us() versus now(); now() and now_ms() are kept for backwards compatibility

◆ now_us()

date Qore::now_us ( )

Returns the current date and time with a resolution to the microsecond.

Returns
the current date and time with a resolution to the microsecond
Code Flags:
CONSTANT
Example:
date d = now_us();
date now_us()
Returns the current date and time with a resolution to the microsecond.
See also
  • now() For a similar function returning the current date and time in the local time zone with coarser granularity, when resolution only to the second is needed
  • now_ms() for a similar function returning the current date and time in the local time zone with coarser granularity, when resolution only to the millisecond is needed
  • now_utc();
Note
There is no performance penalty for using now_ms() and now_us() versus now(); now() and now_ms() are kept for backwards compatibility

◆ now_utc()

date Qore::now_utc ( )

Returns the current UTC date and time with a resolution to the microsecond.

Returns
the current UTC date and time with a resolution to the microsecond
Code Flags:
CONSTANT
Example:
date d = now_utc();
date now_utc()
Returns the current UTC date and time with a resolution to the microsecond.
See also
now_us() for a similar function that returns the current date and time in the local time zone

◆ seconds() [1/2]

nothing Qore::seconds ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ seconds() [2/2]

date Qore::seconds ( softint  seconds)

Returns a relative date/time value in seconds based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
secondsthe number of seconds to return
Returns
a relative date/time value in seconds based on the integer argument passed to be used in date arithmetic
Example:
date rd = seconds(100);
date seconds(softint seconds)
Returns a relative date/time value in seconds based on the integer argument passed to be used in date...
See also

◆ timegm() [1/2]

nothing Qore::timegm ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ timegm() [2/2]

int Qore::timegm ( date  dt)

Returns the number of seconds since January 1, 1970 00:00:00 in the local time zone for the given date.

Code Flags:
CONSTANT
Parameters
dtThe date to process
Returns
the number of seconds since January 1, 1970 00:00:00 in the local time zone for the given date
Example:
int secs = timegm(dt);
int timegm(date dt)
Returns the number of seconds since January 1, 1970 00:00:00 in the local time zone for the given dat...
See also
get_epoch_seconds(date)

◆ years() [1/2]

nothing Qore::years ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP

◆ years() [2/2]

date Qore::years ( softint  years)

Returns a relative date/time value in years based on the integer argument passed to be used in date arithmetic.

Code Flags:
CONSTANT
Parameters
yearsthe number of years to return
Returns
a relative date/time value in years based on the integer argument passed to be used in date arithmetic
Example:
date y = years(100);
date years(softint years)
Returns a relative date/time value in years based on the integer argument passed to be used in date a...
See also