Loading...
Searching...
No Matches
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.
int | Qore::clock_getmillis ()
| Returns an integer representing the system time in milliseconds (1/1000 second intervals since Jan 1, 1970 00:00)
int | Qore::clock_getnanos ()
| Returns an integer representing the system time in nanoseconds (1/1000000000 second intervals) since Jan 1, 1970 00:00:00Z.
date | Qore::date (date dt)
| Returns the date passed.
date | Qore::date (string dtstr)
| Converts the argument to a date and returns the date.
date | Qore::date (softfloat f)
| The argument is assumed to be the number of seconds and fractions of a second.
date | Qore::date (int i)
| The argument is assumed to be the number of seconds.
date | Qore::date ()
| This function just returns 1970-01-01Z.
date | Qore::date (null null)
| This function just returns 1970-01-01Z.
date | Qore::date (string dtstr, string mask)
| Returns the date/time value corresponding to parsing a string argument according to a format mask.
hash< DateTimeInfo > | Qore::date_info (date dt)
| Returns a DateTimeInfo hash for the given date argument (can be either a relative or absolute date)
hash< DateTimeInfo > | Qore::date_info ()
| Returns a DateTimeInfo hash for the current date and time.
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.
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.
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.
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.
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.
string | Qore::format_date (string format, date dt)
| Returns a formatted string for a date argument passed.
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.
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.
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.
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.
int | Qore::getDayOfWeek (date dt)
| Returns an integer representing the day of the week for the absolute date value passed (0=Sunday, 6=Saturday)
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.
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)
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.
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"`)
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.
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")
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.
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.
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.
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)
int | Qore::get_days (date dt)
| Returns an integer corresponding to the literal day value in the date (does not calculate a duration)
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.
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)
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)
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)
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)
int | Qore::get_epoch_microseconds (date dt)
| Returns the number of microseconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC)
int | Qore::get_epoch_milliseconds (date dt)
| Returns the number of milliseconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC)
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.
nothing | Qore::get_epoch_seconds ()
| This function variant does nothing at all.
int | Qore::get_hours (date dt)
| Returns an integer corresponding to the literal hour value in the date (does not calculate a duration)
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.
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)
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"`)
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")
int | Qore::get_microseconds (date dt)
| Returns an integer corresponding to the literal microsecond value in the date (does not calculate a duration)
date | Qore::get_midnight (date dt)
| Returns midnight on the date passed (strips the time component on the new value)
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.
int | Qore::get_milliseconds (date dt)
| Returns an integer corresponding to the literal millisecond value in the date (does not calculate a duration)
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.
int | Qore::get_minutes (date dt)
| Returns an integer corresponding to the literal minute value in the date (does not calculate a duration)
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.
int | Qore::get_months (date dt)
| Returns an integer corresponding to the literal month value in the date (does not calculate a duration)
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.
int | Qore::get_seconds (date dt)
| Returns an integer corresponding to the literal second value in the date (does not calculate a duration)
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.
int | Qore::get_years (date dt)
| Returns an integer corresponding to the literal year value in the date (does not calculate a duration)
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.
date | Qore::gmtime ()
| Returns the current UTC (GMT) time with a resolution of a second.
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)
date | Qore::gmtime (date dt)
| Returns the date and time in UTC (GMT) corresponding to the date argument passed.
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.
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.
bool | Qore::is_date_absolute (date dt)
| Returns True if the argument is an absolute date/time value, False if not.
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.
bool | Qore::is_date_relative (date dt)
| Returns True if the argument is an relative date/time value, False if not.
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.
date | Qore::localtime ()
| Returns the current date and time with a resolution to the second.
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)
date | Qore::localtime (date dt)
| Returns the date and time in the local time zone corresponding to the date argument passed.
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.
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.
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.
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.
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.
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.
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.
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.
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.
date | Qore::now ()
| Returns the current date and time with a resolution to the second.
date | Qore::now_ms ()
| Returns the current date and time with a resolution to the millisecond.
date | Qore::now_us ()
| Returns the current date and time with a resolution to the microsecond.
date | Qore::now_utc ()
| Returns the current UTC date and time with a resolution to the microsecond.
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.
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.
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.
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.
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.
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.

## 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)
`P` | `"AM"` or `"PM"` (upper-case)
`p` | `"am"` or `"pm"` (lower-case)
`S` | non zero-padded second number (0 - 59)
`SS` | zero-padded second number (00 - 59)
`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
`</td>` | time zone UTC offset like +HH:mm[:SS] (ex: `"+01:00"`), seconds only included if non-zero, for UTZ only `"Z"` is added

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
  - `@` was added in Qore 2.0

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:

- `YY:` The last 2 digits of the year; the current century is assumed
- `YYYY:` A 4-digit year value (ex: 1956, 0870)
- `MM:` A 2-digit month number (ex: 01, 11)
- `Mon` or `MON:` A 3-character English month name abbreviation (parsing is case-insensitive: ex: `"Apr"` or `"APR"` or `"apr"` for April)
- `DD:` A 2-digit day number (ex: 29, 04)
- `HH:` A 2-digit hour number (ex: 23, 04)
- `mm:` A 2-digit minute number (ex: 11, 04)
- `ms:` A 3-digit millisecond number (ex: 511, 042)
- `SS:` A 2-digit second number (ex: 11, 04)
- `sss:` A 3-digit millisecond number (ex: 511, 042)
- `ssssss:` A 6-digit microsecond number (ex: 240511, 005142)

- `us:` A 6-digit microsecond number (ex: 240511, 005142)

  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();

See also
  - clock_getmillis()
  - clock_getmicros()

## 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();

See also
  - clock_getnanos()
  - clock_getmicros()

## 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();

See also
  - clock_getmillis()
  - clock_getmicros()

## 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

  dt | the 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

  i | the number of seconds

Returns
  a relative date/time value corresponding to the number of seconds

Example:
  date d = date(i);

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

  f | the 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

  dtstr | string 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-DATE | thrown 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

  dtstr | a string giving a date
  mask | the 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-DATE | invalid 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();

## 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

  dt | the 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

  ms | an 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

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

  us | an 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

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

  days | the 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);

See also
  - years(softint)
  - months(softint)
  - hours(softint)
  - minutes(softint)
  - seconds(softint)
  - milliseconds(softint)
  - microseconds(softint)

## 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

  format | a string giving the format for the date; see Date Formatting Codes for more information about this string
  dt | the 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"

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

  year | the ISO-8601 year (which for some special days does not always correspond to the actual calendar year)
  week | the ISO-8601 week number; if this argument is invalid, an `ISO-8601-INVALID-WEEK` exception is thrown
  day | the 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

Exceptions

  ISO-8601-INVALID-WEEK | The week number is not valid for the given year
  ISO-8601-INVALID-DAY | The 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

  dt | an 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);

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

  dt | an 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);

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

  dt | the 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);

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

  dt | a 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

Note
  - equivalent to <date>::durationMicroseconds()
  - to get the literal microseconds integer value from a date/time value without calculating a duration, use get_microseconds(date)

See also
  - get_duration_seconds_f()
  - get_duration_seconds()
  - get_duration_milliseconds()

## 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

  dt | a 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

Note
  - equivalent to <date>::durationMilliseconds()
  - to get the literal milliseconds integer value from a date/time value without calculating a duration, use get_milliseconds(date)

See also
  - get_duration_seconds_f()
  - get_duration_seconds()
  - get_duration_microseconds()

## 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

  dt | a 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

Note
  - equivalent to <date>::durationSeconds()
  - to get a similar floating-point value with microseconds providing the digits to the right of the decimal place, use get_duration_seconds_f()
  - to get the literal seconds integer value from a date/time value without calculating a duration, use get_seconds(date)

See also
  - get_duration_seconds_f()
  - get_duration_milliseconds()
  - get_duration_microseconds()

## 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

  dt | a 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

Note
  - equivalent to <date>::durationSecondsFloat()
  - to get the literal seconds integer value from a date/time value without calculating a duration, use get_seconds(date)

See also
  - get_duration_seconds()
  - get_duration_milliseconds()
  - get_duration_microseconds()

Since
  Qore 0.8.12

## get_epoch_microseconds()

int Qore::get_epoch_microseconds | ( | date | dt | ) |

Returns the number of microseconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC)

Code Flags:
  CONSTANT

Parameters

  dt | The date to process

Returns
  the number of microseconds 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_microseconds(2012-01-19T08:02:15+01:00);

Since
  Qore 2.0

## get_epoch_milliseconds()

int Qore::get_epoch_milliseconds | ( | date | dt | ) |

Returns the number of milliseconds of the date and time in local time passed since Jan 1, 1970, 00:00:00 Z (UTC)

Code Flags:
  CONSTANT

Parameters

  dt | The date to process

Returns
  the number of milliseconds 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_milliseconds(2012-01-19T08:02:15+01:00);

Since
  Qore 2.0

## get_epoch_seconds() [1/2]

nothing Qore::get_epoch_seconds | ( |  | ) |

This function variant does nothing at all.

Code Flags:
  RUNTIME_NOOP

This variant is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments

## 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

  dt | The 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);

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

  dt | the 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);

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

  dt | an 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);

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

  dt | the 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

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

  dt | the 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"

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

  dt | the 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);

Note
  - equivalent to pseudo-method <date>::microseconds()
  - to get the number of microseconds of duration in a date/time value, use get_duration_microseconds() instead

## 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

  dt | the date to process

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

Example:
  date midnight = get_midnight(dt);

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

  dt | the 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);

Note
  - equivalent to pseudo-method <date>::milliseconds()
  - to get the number of milliseconds of duration in a date/time value, use get_duration_milliseconds() instead

## 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

  dt | the 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);

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

  dt | the 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);

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

  dt | the 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);

Note
  - equivalent to pseudo-method <date>::seconds()
  - to get the number of seconds of duration in a date/time value, use get_duration_seconds() instead

## 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

  dt | the 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);

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

  year | the ISO-8601 year (which for some special days does not always correspond to the actual calendar year)
  week | the ISO-8601 week number; if this argument is invalid, an `ISO-8601-INVALID-WEEK` exception is thrown
  day | the 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-WEEK | The week number is not valid for the given year
  ISO-8601-INVALID-DAY | The 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

  dt | an 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

  dt | an 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

  dt | an 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

  dt | the 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

  dt | the 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"

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();

See also
  - now_utc()
  - localtime()

## 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

  dt | a 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

  secs | the number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC)
  us | a 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

  hours | the 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);

See also
  - years(softint)
  - months(softint)
  - hours(softint)
  - minutes(softint)
  - seconds(softint)
  - milliseconds(softint)
  - microseconds(softint)

## 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

  dt | the date to check

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

Example:
  bool b = is_date_absolute(dt)

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

  dt | the date to check

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

Example:
  bool b = is_date_relative(dt)

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();

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

  dt | a 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

  secs | the number of seconds and microseconds since Jan 1, 1970, 00:00:00 Z (UTC)
  us | a 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

  us | the 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);

See also
  - years(softint)
  - months(softint)
  - days(softint)
  - hours(softint)
  - minutes(softint)
  - seconds(softint)
  - milliseconds(softint)

## 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

  ms | the 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);

See also
  - years(softint)
  - months(softint)
  - days(softint)
  - hours(softint)
  - minutes(softint)
  - seconds(softint)
  - microseconds(softint)

## 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

  minutes | the 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);

See also
  - years(softint)
  - months(softint)
  - days(softint)
  - hours(softint)
  - seconds(softint)
  - milliseconds(softint)
  - microseconds(softint)

## 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

  dt | The 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);

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

  months | the 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);

See also
  - years(softint)
  - days(softint)
  - hours(softint)
  - minutes(softint)
  - seconds(softint)
  - milliseconds(softint)
  - microseconds(softint)

## 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();

See also
  - now_ms()
  - now_us()
  - now_utc()

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();

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();

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();

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

  seconds | the 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);

See also
  - years(softint)
  - months(softint)
  - days(softint)
  - hours(softint)
  - minutes(softint)
  - milliseconds(softint)
  - microseconds(softint)

## 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

  dt | The 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);

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

  years | the 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);

See also
  - months(softint)
  - days(softint)
  - hours(softint)
  - minutes(softint)
  - seconds(softint)
  - milliseconds(softint)
  - microseconds(softint)