GmtTime

GmtTime

new GmtTime()

Methods

(static) epoch()

get an Epoch GmtTime instance, which stands for "1970-01-01T00:00:00Z+00:00".

Returns:

GmtTime stands for EPOCH.

(static) isLeapYear(year)

to judge a "yyyy" is a leap year or not.

Parameters:
Name Type Description
year

a u32 value "yyyy" stands for year.

(static) localTimeToGmtTime(a)

convert a local time to Gmttime.

Parameters:
Name Type Description
a

local time to convert.

Returns:

GmtTime instance.

(static) secondsBetweenLocalTime(time, base)

calculate gap of seconds between local times.

Parameters:
Name Type Description
time

left time to compare

base

right time to compare.

Returns:

u32, unit is seconds.

toLocalTime(timezone)

convert GmtTime to LocalTime according to TimeZone.

Parameters:
Name Type Description
timezone

a string stands for UTC time zone. It must be formatted as "+hh:mm" which means east time zone, and "-hh:mm" which means west time zone.

GmtTime

new GmtTime()

class GmtTime stands for a GMT time.

Example
import { GmtTime } from "ultrain-ts-lib/src/time;"

Methods

(static) epoch()

get an Epoch GmtTime instance, which stands for "1970-01-01T00:00:00Z+00:00".

Returns:

GmtTime stands for EPOCH.

(static) isLeapYear(year)

to judge a "yyyy" is a leap year or not.

Parameters:
Name Type Description
year

a u32 value "yyyy" stands for year.

(static) localTimeToGmtTime(a)

convert a local time to Gmttime.

Parameters:
Name Type Description
a

local time to convert.

Returns:

GmtTime instance.

(static) secondsBetweenLocalTime(time, base)

calculate gap of seconds between local times.

Parameters:
Name Type Description
time

left time to compare

base

right time to compare.

Returns:

u32, unit is seconds.

toLocalTime(timezone)

convert GmtTime to LocalTime according to TimeZone.

Parameters:
Name Type Description
timezone

a string stands for UTC time zone. It must be formatted as "+hh:mm" which means east time zone, and "-hh:mm" which means west time zone.