Struct Date

#[repr(transparent)]
pub struct Date { /* private fields */ }

Implementations

impl Date

fn get_utc_seconds(&self) -> u32

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

MDN documentation

impl Date

fn to_time_string(&self) -> JsString

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

MDN documentation

impl Date

fn new_with_year_month(year: u32, month: i32) -> Date

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.

MDN documentation

impl Date

fn value_of(&self) -> f64

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

MDN documentation

impl Date

fn new_with_year_month_day_hr_min(year: u32, month: i32, day: i32, hr: i32, min: i32) -> Date

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.

MDN documentation

impl Date

fn now() -> f64

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

MDN documentation

impl Date

fn set_full_year(&self, year: u32) -> f64

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

MDN documentation

impl Date

fn set_hours(&self, hours: u32) -> f64

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.

MDN documentation

impl Date

fn set_month(&self, month: u32) -> f64

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

MDN documentation

impl Date

fn get_date(&self) -> u32

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

MDN documentation

impl Date

fn set_utc_date(&self, day: u32) -> f64

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

MDN documentation

impl Date

fn get_hours(&self) -> u32

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

MDN documentation

impl Date

fn set_utc_full_year_with_month_date(&self, year: u32, month: i32, date: i32) -> f64

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

MDN documentation

impl Date

fn get_month(&self) -> u32

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).

MDN documentation

impl Date

fn set_utc_minutes(&self, minutes: u32) -> f64

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

MDN documentation

impl Date

fn get_timezone_offset(&self) -> f64

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

MDN documentation

impl Date

fn to_date_string(&self) -> JsString

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

MDN documentation

impl Date

fn get_utc_full_year(&self) -> u32

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

MDN documentation

impl Date

fn to_locale_date_string(&self, locale: &str, options: &JsValue) -> JsString

The toLocaleDateString() method returns a string with a language sensitive representation of the date portion of this date. The new locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function. In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent.

MDN documentation

impl Date

fn get_utc_minutes(&self) -> u32

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

MDN documentation

impl Date

fn to_locale_time_string_with_options(&self, locale: &str, options: &JsValue) -> JsString

impl Date

fn new(init: &JsValue) -> Date

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.

MDN documentation

impl Date

fn to_utc_string(&self) -> JsString

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

MDN documentation

impl Date

fn new_with_year_month_day(year: u32, month: i32, day: i32) -> Date

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.

MDN documentation

impl Date

fn new_with_year_month_day_hr_min_sec(year: u32, month: i32, day: i32, hr: i32, min: i32, sec: i32) -> Date

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.

MDN documentation

impl Date

fn parse(date: &str) -> f64

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).

MDN documentation

impl Date

fn set_full_year_with_month(&self, year: u32, month: i32) -> f64

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

MDN documentation

impl Date

fn set_milliseconds(&self, milliseconds: u32) -> f64

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

MDN documentation

impl Date

fn set_seconds(&self, seconds: u32) -> f64

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

MDN documentation

impl Date

fn get_day(&self) -> u32

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

MDN documentation

impl Date

fn set_utc_full_year(&self, year: u32) -> f64

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

MDN documentation

impl Date

fn get_milliseconds(&self) -> u32

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

MDN documentation

impl Date

fn set_utc_hours(&self, hours: u32) -> f64

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.

MDN documentation

impl Date

fn get_seconds(&self) -> u32

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

MDN documentation

impl Date

fn set_utc_month(&self, month: u32) -> f64

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

MDN documentation

impl Date

fn get_utc_date(&self) -> u32

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

MDN documentation

impl Date

fn to_iso_string(&self) -> JsString

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"

MDN documentation

impl Date

fn get_utc_hours(&self) -> u32

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

MDN documentation

impl Date

fn to_locale_string(&self, locale: &str, options: &JsValue) -> JsString

The toLocaleString() method returns a string with a language sensitive representation of this date. The new locales and options arguments let applications specify the language whose formatting conventions should be used and customize the behavior of the function. In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent.

MDN documentation

impl Date

fn get_utc_month(&self) -> u32

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).

MDN documentation

impl Date

fn to_string(&self) -> JsString

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

MDN documentation

impl Date

fn new_0() -> Date

Creates a JavaScript Date instance that represents the current moment in time.

MDN documentation

impl Date

fn utc(year: f64, month: f64) -> f64

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.

MDN documentation

impl Date

fn new_with_year_month_day_hr(year: u32, month: i32, day: i32, hr: i32) -> Date

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.

MDN documentation

impl Date

fn new_with_year_month_day_hr_min_sec_milli(year: u32, month: i32, day: i32, hr: i32, min: i32, sec: i32, milli: i32) -> Date

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.

MDN documentation

impl Date

fn set_date(&self, day: u32) -> f64

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

MDN documentation

impl Date

fn set_full_year_with_month_date(&self, year: u32, month: i32, date: i32) -> f64

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

MDN documentation

impl Date

fn set_minutes(&self, minutes: u32) -> f64

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

MDN documentation

impl Date

fn set_time(&self, time: f64) -> f64

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

MDN documentation

impl Date

fn get_full_year(&self) -> u32

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

MDN documentation

impl Date

fn set_utc_full_year_with_month(&self, year: u32, month: i32) -> f64

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

MDN documentation

impl Date

fn get_minutes(&self) -> u32

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

MDN documentation

impl Date

fn set_utc_milliseconds(&self, milliseconds: u32) -> f64

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

MDN documentation

impl Date

fn get_time(&self) -> f64

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

MDN documentation

impl Date

fn set_utc_seconds(&self, seconds: u32) -> f64

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

MDN documentation

impl Date

fn get_utc_day(&self) -> u32

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

MDN documentation

impl Date

fn to_json(&self) -> JsString

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

MDN documentation

impl Date

fn get_utc_milliseconds(&self) -> u32

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

MDN documentation

impl Date

fn to_locale_time_string(&self, locale: &str) -> JsString

The toLocaleTimeString() method returns a string with a language sensitive representation of the time portion of this date. The new locales and options arguments let applications specify the language whose formatting conventions should be used and customize the behavior of the function. In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent.

MDN documentation

Trait Implementations

impl AsRef<Date> for Date

fn as_ref(&self) -> &Date

impl AsRef<JsValue> for Date

fn as_ref(&self) -> &JsValue

impl AsRef<Object> for Date

fn as_ref(&self) -> &Object

impl Clone for Date

fn clone(&self) -> Self

impl Debug for Date

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Deref for Date

type Target = Object;
fn deref(&self) -> &Object

impl Eq for Date

impl ErasableGeneric for Date

type Repr = JsValue;

impl From<JsValue> for Date

fn from(obj: JsValue) -> Self

impl FromWasmAbi for Date

type Abi = <JsValue as FromWasmAbi>::Abi;
unsafe fn from_abi(js: Self::Abi) -> Self

impl IntoJsGeneric for Date where Date: JsGeneric,

type JsCanon = Date;
fn to_js(self) -> Date

impl IntoWasmAbi for Date

type Abi = <JsValue as IntoWasmAbi>::Abi;
fn into_abi(self) -> Self::Abi

impl JsCast for Date

fn instanceof(val: &JsValue) -> bool
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self

impl LongRefFromWasmAbi for Date

type Abi = <JsValue as LongRefFromWasmAbi>::Abi;
type Anchor = Date;
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

impl OptionFromWasmAbi for Date

fn is_none(abi: &Self::Abi) -> bool

impl OptionIntoWasmAbi for Date

fn none() -> Self::Abi

impl PartialEq for Date

fn eq(&self, other: &Self) -> bool

impl Promising for Date

type Resolution = Date;

impl RefFromWasmAbi for Date

type Abi = <JsValue as RefFromWasmAbi>::Abi;
type Anchor = ManuallyDrop<Date>;
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

impl StructuralPartialEq for Date

impl UpcastFrom<Date> for Date

impl WasmDescribe for Date

fn describe()

Auto Trait Implementations

impl Freeze for Date

impl RefUnwindSafe for Date

impl Send for Date

impl Sync for Date

impl Unpin for Date

impl UnsafeUnpin for Date

impl UnwindSafe for Date

Blanket Implementations

impl<P, T> Receiver for Date where P: Deref<Target = T> + ?Sized, T: ?Sized,

impl<S, T> Upcast<T> for Date where T: UpcastFrom<S> + ?Sized, S: ?Sized,

impl<T> Any for Date where T: 'static + ?Sized,

impl<T> Borrow<T> for Date where T: ?Sized,

impl<T> BorrowMut<T> for Date where T: ?Sized,

impl<T> CloneToUninit for Date where T: Clone,

impl<T> From<T> for Date

impl<T> JsGeneric for Date where T: ErasableGeneric<Repr = JsValue> + UpcastFrom<T> + Upcast<JsValue> + JsCast + 'static,

impl<T> ReturnWasmAbi for Date where T: IntoWasmAbi,

impl<T> ToOwned for Date where T: Clone,

impl<T> TryFromJsValue for Date where T: JsCast,

impl<T> VectorFromWasmAbi for Date where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorIntoWasmAbi for Date where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorRefIntoWasmAbi for Date where &'a T: for<'a> Into<JsValue>,

impl<T, U> Into<U> for Date where U: From<T>,

impl<T, U> TryFrom<U> for Date where U: Into<T>,

impl<T, U> TryInto<U> for Date where U: TryFrom<T>,