Timezone

From MemCP
Jump to navigation Jump to search

← Back to Full SCM API documentation

unix_timestamp

returns a unix timestamp (integer seconds since epoch)

Allowed number of parameters: 0–1

Parameters

  • dt (any): optional datetime value to convert (optional)

Returns

int

system_time_zone

returns the operating system's local timezone name

Allowed number of parameters: 0–0

Parameters

This function has no parameters.

Returns

string

convert_tz

converts a datetime from one timezone to another

Allowed number of parameters: 3–3

Parameters

  • dt (any): datetime value
  • from_tz (string): source timezone
  • to_tz (string): target timezone

Returns

date

from_unixtime

converts a unix timestamp to a datetime in the session timezone

Allowed number of parameters: 1–2

Parameters

  • unix_ts (number): unix timestamp (seconds since epoch)
  • format (string): optional MySQL format string (optional)

Returns

date

utc_timestamp

returns the current UTC datetime

Allowed number of parameters: 0–0

Parameters

This function has no parameters.

Returns

date

utc_date

returns the current UTC date (midnight)

Allowed number of parameters: 0–0

Parameters

This function has no parameters.

Returns

date

utc_time

returns the current UTC time (as a datetime at epoch date)

Allowed number of parameters: 0–0

Parameters

This function has no parameters.

Returns

date

sysdate

returns the current datetime (re-evaluated per call, unlike now())

Allowed number of parameters: 0–0

Parameters

This function has no parameters.

Returns

date

at_time_zone

PostgreSQL AT TIME ZONE operator: converts between timezones

Allowed number of parameters: 2–2

Parameters

  • dt (any): datetime value
  • zone (string): target timezone

Returns

date

timestampdiff

returns the difference between two datetimes in the given unit

Allowed number of parameters: 3–3

Parameters

  • unit (string): SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
  • dt1 (any): first datetime
  • dt2 (any): second datetime

Returns

int