[][src]Struct stdweb::web::Date

pub struct Date(_);

(JavaScript docs) https://www.ecma-international.org/ecma-262/6.0/#sec-date-constructor

Methods

impl Date[src]

pub fn new() -> Self[src]

Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January 1970 UTC.

(JavaScript docs)

pub fn from_datetime(
    year: i32,
    month: i32,
    day: i32,
    hours: i32,
    minutes: i32,
    seconds: i32,
    milliseconds: i32
) -> Self
[src]

Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January 1970 UTC.

year is an integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999. month is an integer value representing the month, beginning with 0 for January to 11 for December day is an integer value representing the day of the month (normally from 1 to 31) hours an integer value representing the minute segment of a time seconds an integer value representing the second segment of a time milliseconds an integer value representing the millisecond segment of a time

(JavaScript docs)

pub fn from_iso8601(date_string: &str) -> Self[src]

Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January 1970 UTC.

String value representing a date. The string should be in a format recognized by the Date.parse() method (IETF-compliant RFC 2822 timestamps and also a version of ISO8601).

(JavaScript docs)

pub fn from_time(now: f64) -> Self[src]

Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January 1970 UTC.

Integer value representing the number of milliseconds since January 1, 1970, 00:00:00 UTC, with leap seconds ignored (Unix Epoch; but consider that most Unix timestamp functions count in seconds).

(JavaScript docs)

pub fn utc(
    year: i32,
    month: i32,
    day: i32,
    hours: i32,
    minutes: i32,
    seconds: i32,
    milliseconds: i32
) -> f64
[src]

The Date.UTC() method accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time.

(JavaScript docs)

pub fn parse(date_string: &str) -> f64[src]

The Date.parse() method parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or NaN if the string is unrecognized or, in some cases, contains illegal date values (e.g. 2015-02-31).

(JavaScript docs)

pub fn now() -> f64[src]

The Date.now() method returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.

(JavaScript docs)

pub fn get_date(&self) -> i32[src]

The getDate() method returns the day of the month for the specified date according to local time.

(JavaScript docs)

pub fn get_day(&self) -> i32[src]

The getDay() method returns the day of the week for the specified date according to local time, where 0 represents Sunday. For the day of the month see getDate().

(JavaScript docs)

pub fn get_full_year(&self) -> i32[src]

The getFullYear() method returns the year of the specified date according to local time.

(JavaScript docs)

pub fn get_hours(&self) -> i32[src]

The getHours() method returns the hour for the specified date, according to local time.

(JavaScript docs)

pub fn get_milliseconds(&self) -> i32[src]

The getMilliseconds() method returns the milliseconds in the specified date according to local time.

(JavaScript docs)

pub fn get_minutes(&self) -> i32[src]

The getMinutes() method returns the minutes in the specified date according to local time.

(JavaScript docs)

pub fn get_month(&self) -> i32[src]

The getMonth() method returns the month in the specified date according to local time, as a zero-based value (where zero indicates the first month of the year).

(JavaScript docs)

pub fn get_seconds(&self) -> i32[src]

The getSeconds() method returns the seconds in the specified date according to local time.

(JavaScript docs)

pub fn get_time(&self) -> f64[src]

The getTime() method returns the numeric value corresponding to the time for the specified date according to universal time.

getTime() always uses UTC for time representation. For example, a client browser in one timezone, getTime() will be the same as a client browser in any other timezone.

You can use this method to help assign a date and time to another Date object. This method is functionally equivalent to the valueOf() method.

(JavaScript docs)

pub fn get_timezone_offset(&self) -> i32[src]

The getTimezoneOffset() method returns the time zone difference, in minutes, from current locale (host system settings) to UTC.

(JavaScript docs)

pub fn get_utc_date(&self) -> i32[src]

The getUTCDate() method returns the day (date) of the month in the specified date according to universal time.

(JavaScript docs)

pub fn get_utc_day(&self) -> i32[src]

The getUTCDay() method returns the day of the week in the specified date according to universal time, where 0 represents Sunday.

(JavaScript docs)

pub fn get_utc_full_year(&self) -> i32[src]

The getUTCFullYear() method returns the year in the specified date according to universal time.

(JavaScript docs)

pub fn get_utc_hours(&self) -> i32[src]

The getUTCHours() method returns the hours in the specified date according to universal time.

(JavaScript docs)

pub fn get_utc_milliseconds(&self) -> i32[src]

The getUTCMilliseconds() method returns the milliseconds in the specified date according to universal time.

(JavaScript docs)

pub fn get_utc_minutes(&self) -> i32[src]

The getUTCMinutes() method returns the minutes in the specified date according to universal time.

(JavaScript docs)

pub fn get_utc_month(&self) -> i32[src]

The getUTCMonth() returns the month of the specified date according to universal time, as a zero-based value (where zero indicates the first month of the year).

(JavaScript docs)

pub fn get_utc_seconds(&self) -> i32[src]

The getUTCSeconds() method returns the seconds in the specified date according to universal time.

(JavaScript docs)

pub fn set_date(&self, date: i32)[src]

The setDate() method sets the day of the Date object relative to the beginning of the currently set month.

(JavaScript docs)

pub fn set_full_year(&self, full_year: i32)[src]

The setFullYear() method sets the full year for a specified date according to local time. Returns new timestamp.

(JavaScript docs)

pub fn set_hours(&self, hours: i32)[src]

The setHours() method sets the hours for a specified date according to local time, and returns the number of milliseconds since January 1, 1970 00:00:00 UTC until the time represented by the updated Date instance.

(JavaScript docs)

pub fn set_milliseconds(&self, milliseconds: i32)[src]

The setMilliseconds() method sets the milliseconds for a specified date according to local time.

(JavaScript docs)

pub fn set_minutes(&self, minutes: i32)[src]

The setMinutes() method sets the minutes for a specified date according to local time.

(JavaScript docs)

pub fn set_month(&self, month: i32)[src]

The setMonth() method sets the month for a specified date according to the currently set year.

(JavaScript docs)

pub fn set_seconds(&self, seconds: i32)[src]

The setSeconds() method sets the seconds for a specified date according to local time.

(JavaScript docs)

pub fn set_time(&self, time: f64)[src]

The setTime() method sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.

(JavaScript docs)

pub fn set_utc_date(&self, date: i32)[src]

The setUTCDate() method sets the day of the month for a specified date according to universal time.

(JavaScript docs)

pub fn set_utc_full_year(&self, full_year: i32)[src]

The setUTCFullYear() method sets the full year for a specified date according to universal time.

(JavaScript docs)

pub fn set_utc_hours(&self, hours: i32)[src]

The setUTCHours() method sets the hour for a specified date according to universal time, and returns the number of milliseconds since January 1, 1970 00:00:00 UTC until the time represented by the updated Date instance.

(JavaScript docs)

pub fn set_utc_milliseconds(&self, milliseconds: i32)[src]

The setUTCMilliseconds() method sets the milliseconds for a specified date according to universal time.

(JavaScript docs)

pub fn set_utc_minutes(&self, minutes: i32)[src]

The setUTCMinutes() method sets the minutes for a specified date according to universal time.

(JavaScript docs)

pub fn set_utc_month(&self, month: i32)[src]

The setUTCMonth() method sets the month for a specified date according to universal time.

(JavaScript docs)

pub fn set_utc_seconds(&self, seconds: i32)[src]

The setUTCSeconds() method sets the seconds for a specified date according to universal time.

(JavaScript docs)

pub fn to_date_string(&self) -> String[src]

The toDateString() method returns the date portion of a Date object in human readable form in American English.

(JavaScript docs)

pub fn to_iso_string(&self) -> String[src]

The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always zero UTC offset, as denoted by the suffix "Z".

(JavaScript docs)

pub fn to_json(&self) -> String[src]

The toJSON() method returns a string representation of the Date object.

(JavaScript docs)

pub fn to_string(&self) -> String[src]

The toString() method returns a string representing the specified Date object.

(JavaScript docs)

pub fn to_time_string(&self) -> String[src]

The toTimeString() method returns the time portion of a Date object in human readable form in American English.

(JavaScript docs)

pub fn to_utc_string(&self) -> String[src]

The toUTCString() method converts a date to a string, using the UTC time zone.

(JavaScript docs)

pub fn value_of(&self) -> f64[src]

The valueOf() method returns the primitive value of a Date object.

(JavaScript docs)

Trait Implementations

impl JsSerialize for Date[src]

impl TryFrom<Date> for Reference[src]

type Error = Void

The type returned in the event of a conversion error.

impl TryFrom<Reference> for Date[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Reference> for Date[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Value> for Date[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Value> for Date[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl InstanceOf for Date[src]

impl ReferenceType for Date[src]

impl AsRef<Reference> for Date[src]

impl From<Date> for Reference[src]

impl Clone for Date[src]

impl Eq for Date[src]

impl PartialEq<Date> for Date[src]

impl Debug for Date[src]

Auto Trait Implementations

impl Send for Date

impl Sync for Date

impl Unpin for Date

impl UnwindSafe for Date

impl RefUnwindSafe for Date

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]