arquero
Version:
Query processing and transformation of array-backed data tables.
229 lines (228 loc) • 10.4 kB
TypeScript
/**
* Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatted
* string for the given *date* in local timezone. The resulting string is
* compatible with *parse_date* and JavaScript's built-in *Date.parse*.
* @param {Date | number} date The input Date or timestamp value.
* @param {boolean} [shorten=false] A boolean flag (default `false`)
* indicating if the formatted string should be shortened if possible.
* For example, the local date `2001-01-01` will shorten from
* `"2001-01-01T00:00:00.000"` to `"2001-01-01T00:00"`.
* @return {string} The formatted date string in local time.
*/
export function format_date(date: Date | number, shorten?: boolean): string;
/**
* Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatted
* string for the given *date* in Coordinated Universal Time (UTC). The
* resulting string is compatible with *parse_date* and JavaScript's
* built-in *Date.parse*.
* @param {Date | number} date The input Date or timestamp value.
* @param {boolean} [shorten=false] A boolean flag (default `false`)
* indicating if the formatted string should be shortened if possible.
* For example, the the UTC date `2001-01-01` will shorten from
* `"2001-01-01T00:00:00.000Z"` to `"2001-01-01"`
* @return {string} The formatted date string in UTC time.
*/
export function format_utcdate(date: Date | number, shorten?: boolean): string;
/**
* Returns the number of milliseconds elapsed since midnight, January 1,
* 1970 Universal Coordinated Time (UTC).
* @return {number} The timestamp for now.
*/
export function now(): number;
/**
* Returns the timestamp for a *date* as the number of milliseconds elapsed
* since January 1, 1970 00:00:00 UTC.
* @param {Date | number} date The input Date value.
* @return {number} The timestamp value.
*/
export function timestamp(date: Date | number): number;
/**
* Creates and returns a new Date value. If no arguments are provided,
* the current date and time are used.
* @param {number} [year] The year.
* @param {number} [month=0] The (zero-based) month.
* @param {number} [date=1] The date within the month.
* @param {number} [hours=0] The hour within the day.
* @param {number} [minutes=0] The minute within the hour.
* @param {number} [seconds=0] The second within the minute.
* @param {number} [milliseconds=0] The milliseconds within the second.
* @return {Date} The Date value.
*/
export function datetime(year?: number, month?: number, date?: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number, ...args: any[]): Date;
/**
* Returns the year of the specified *date* according to local time.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The year value in local time.
*/
export function year(date: Date | number): number;
/**
* Returns the zero-based quarter of the specified *date* according to
* local time.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The quarter value in local time.
*/
export function quarter(date: Date | number): number;
/**
* Returns the zero-based month of the specified *date* according to local
* time. A value of `0` indicates January, `1` indicates February, and so on.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The month value in local time.
*/
export function month(date: Date | number): number;
/**
* Returns the week number of the year (0-53) for the specified *date*
* according to local time. By default, Sunday is used as the first day
* of the week. All days in a new year preceding the first Sunday are
* considered to be in week 0.
* @param {Date | number} date The input Date or timestamp value.
* @param {number} firstday The number of first day of the week (default
* `0` for Sunday, `1` for Monday and so on).
* @return {number} The week of the year in local time.
*/
export function week(date: Date | number, firstday: number): number;
/**
* Returns the date (day of month) of the specified *date* according
* to local time.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The date (day of month) value.
*/
export function date(date: Date | number): number;
/**
* Returns the day of the year (1-366) of the specified *date* according
* to local time.
* @param {Date | number} date A date or timestamp.
* @return {number} The day of the year in local time.
*/
export function dayofyear(date: Date | number): number;
/**
* Returns the Sunday-based day of the week (0-6) of the specified *date*
* according to local time. A value of `0` indicates Sunday, `1` indicates
* Monday, and so on.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The day of the week value in local time.
*/
export function dayofweek(date: Date | number): number;
/**
* Returns the hour of the day for the specified *date* according
* to local time.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The hour value in local time.
*/
export function hours(date: Date | number): number;
/**
* Returns the minute of the hour for the specified *date* according
* to local time.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The minutes value in local time.
*/
export function minutes(date: Date | number): number;
/**
* Returns the seconds of the minute for the specified *date* according
* to local time.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The seconds value in local time.
*/
export function seconds(date: Date | number): number;
/**
* Returns the milliseconds of the second for the specified *date* according
* to local time.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The milliseconds value in local time.
*/
export function milliseconds(date: Date | number): number;
/**
* Creates and returns a new Date value using Coordinated Universal Time
* (UTC). If no arguments are provided, the current date and time are used.
* @param {number} [year] The year.
* @param {number} [month=0] The (zero-based) month.
* @param {number} [date=1] The date within the month.
* @param {number} [hours=0] The hour within the day.
* @param {number} [minutes=0] The minute within the hour.
* @param {number} [seconds=0] The second within the minute.
* @param {number} [milliseconds=0] The milliseconds within the second.
* @return {Date} The Date value.
*/
export function utcdatetime(year?: number, month?: number, date?: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number, ...args: any[]): Date;
/**
* Returns the year of the specified *date* according to Coordinated
* Universal Time (UTC).
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The year value in UTC time.
*/
export function utcyear(date: Date | number): number;
/**
* Returns the zero-based quarter of the specified *date* according to
* Coordinated Universal Time (UTC)
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The quarter value in UTC time.
*/
export function utcquarter(date: Date | number): number;
/**
* Returns the zero-based month of the specified *date* according to
* Coordinated Universal Time (UTC). A value of `0` indicates January,
* `1` indicates February, and so on.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The month value in UTC time.
*/
export function utcmonth(date: Date | number): number;
/**
* Returns the week number of the year (0-53) for the specified *date*
* according to Coordinated Universal Time (UTC). By default, Sunday is
* used as the first day of the week. All days in a new year preceding the
* first Sunday are considered to be in week 0.
* @param {Date | number} date The input Date or timestamp value.
* @param {number} firstday The number of first day of the week (default
* `0` for Sunday, `1` for Monday and so on).
* @return {number} The week of the year in UTC time.
*/
export function utcweek(date: Date | number, firstday: number): number;
/**
* Returns the date (day of month) of the specified *date* according to
* Coordinated Universal Time (UTC).
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The date (day of month) value in UTC time.
*/
export function utcdate(date: Date | number): number;
/**
* Returns the day of the year (1-366) of the specified *date* according
* to Coordinated Universal Time (UTC).
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The day of the year in UTC time.
*/
export function utcdayofyear(date: Date | number): number;
/**
* Returns the Sunday-based day of the week (0-6) of the specified *date*
* according to Coordinated Universal Time (UTC). A value of `0` indicates
* Sunday, `1` indicates Monday, and so on.
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The day of the week in UTC time.
*/
export function utcdayofweek(date: Date | number): number;
/**
* Returns the hour of the day for the specified *date* according to
* Coordinated Universal Time (UTC).
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The hours value in UTC time.
*/
export function utchours(date: Date | number): number;
/**
* Returns the minute of the hour for the specified *date* according to
* Coordinated Universal Time (UTC).
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The minutes value in UTC time.
*/
export function utcminutes(date: Date | number): number;
/**
* Returns the seconds of the minute for the specified *date* according to
* Coordinated Universal Time (UTC).
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The seconds value in UTC time.
*/
export function utcseconds(date: Date | number): number;
/**
* Returns the milliseconds of the second for the specified *date* according to
* Coordinated Universal Time (UTC).
* @param {Date | number} date The input Date or timestamp value.
* @return {number} The milliseconds value in UTC time.
*/
export function utcmilliseconds(date: Date | number): number;