public class JSDate extends JSObject
JSObject.jsexport, JSObject.Property<T>
JSPropertyAttributeDontDelete, JSPropertyAttributeDontEnum, JSPropertyAttributeNone, JSPropertyAttributeReadOnly
Constructor and Description |
---|
JSDate(JSContext ctx)
Creates a new date object with the current date and time
|
JSDate(JSContext ctx,
java.util.Date date)
Creates a new date object, initialized with a Java timestamp
|
JSDate(JSContext ctx,
java.lang.Integer... params)
Creates a new data object, initialized by date components
|
JSDate(JSContext ctx,
java.lang.Long epoch)
Creates a new date object, initialized with a Java timestamp
|
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
getDate()
JavaScript Date.prototype.getDate(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDate
|
java.lang.Integer |
getDay()
JavaScript Date.prototype.getDay(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay
|
java.lang.Integer |
getFullYear()
JavaScript Date.prototype.getFullYear(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getFullYear
|
java.lang.Integer |
getHours()
JavaScript Date.prototype.getHours(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours
|
java.lang.Integer |
getMilliseconds()
JavaScript Date.prototype.getMilliseconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds
|
java.lang.Integer |
getMinutes()
JavaScript Date.prototype.getMinutes(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMinutes
|
java.lang.Integer |
getMonth()
JavaScript Date.prototype.getMonth(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth
|
java.lang.Integer |
getSeconds()
JavaScript Date.prototype.getSeconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getSeconds
|
java.lang.Long |
getTime()
JavaScript Date.prototype.getTime(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime
|
java.lang.Integer |
getTimezoneOffset()
JavaScript Date.prototype.getTimezoneOffset(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
|
java.lang.Integer |
getUTCDate()
JavaScript Date.prototype.getUTCDate(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCDate
|
java.lang.Integer |
getUTCDay()
JavaScript Date.prototype.getUTCDay(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCDay
|
java.lang.Integer |
getUTCFullYear()
JavaScript Date.prototype.getUTCFullYear(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCFullYear
|
java.lang.Integer |
getUTCHours()
JavaScript Date.prototype.getUTCHours(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCHours
|
java.lang.Integer |
getUTCMilliseconds()
JavaScript Date.prototype.getUTCMilliseconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds
|
java.lang.Integer |
getUTCMinutes()
JavaScript Date.prototype.getUTCMinutes(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCMinutes
|
java.lang.Integer |
getUTCMonth()
JavaScript Date.prototype.getUTCMonth(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCMonth
|
java.lang.Integer |
getUTCSeconds()
JavaScript Date.prototype.getUTCSeconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCSeconds
|
static java.lang.Long |
now(JSContext ctx)
JavaScript Date.now(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
|
static java.lang.Long |
parse(JSContext ctx,
java.lang.String string)
JavaScript Date.parse(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
Parses a string representation of a date and returns the number of milliseconds since 1
January, 1970, 00:00:00, UTC.
|
void |
setDate(java.lang.Integer value)
JavaScript Date.prototype.setDate(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setDate
|
void |
setFullYear(java.lang.Integer value)
JavaScript Date.prototype.setFullYear(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setFullYear
|
void |
setHours(java.lang.Integer value)
JavaScript Date.prototype.setHours(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setHours
|
void |
setMilliseconds(java.lang.Integer value)
JavaScript Date.prototype.setMilliseconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMilliseconds
|
void |
setMinutes(java.lang.Integer value)
JavaScript Date.prototype.setMinutes(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMinutes
|
void |
setMonth(java.lang.Integer value)
JavaScript Date.prototype.setMonth(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMonth
|
void |
setSeconds(java.lang.Integer value)
JavaScript Date.prototype.setSeconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setSeconds
|
void |
setTime(java.lang.Long value)
JavaScript Date.prototype.setTime(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setTime
|
void |
setUTCDate(java.lang.Integer value)
JavaScript Date.prototype.setUTCDate(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCDate
|
void |
setUTCFullYear(java.lang.Integer value)
JavaScript Date.prototype.setUTCFullYear(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCFullYear
|
void |
setUTCHours(java.lang.Integer value)
JavaScript Date.prototype.setUTCHours(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCHours
|
void |
setUTCMilliseconds(java.lang.Integer value)
JavaScript Date.prototype.setUTCMilliseconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds
|
void |
setUTCMinutes(java.lang.Integer value)
JavaScript Date.prototype.setUTCMinutes(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCMinutes
|
void |
setUTCMonth(java.lang.Integer value)
JavaScript Date.prototype.setUTCMonth(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCMonth
|
void |
setUTCSeconds(java.lang.Integer value)
JavaScript Date.prototype.setUTCSeconds(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCSeconds
|
java.lang.String |
toDateString()
JavaScript Date.prototype.toDateString(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toDateString
|
java.lang.String |
toISOString()
JavaScript Date.prototype.toISOString(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
java.lang.String |
toJSON()
JavaScript Date.prototype.toJSON(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON
|
java.lang.String |
toTimeString()
JavaScript Date.prototype.toTimeString(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toTimeString
|
java.lang.String |
toUTCString()
JavaScript Date.prototype.toUTCString(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString
|
static java.lang.Long |
UTC(JSContext ctx,
java.lang.Integer... params)
JavaScript Date.UTC(), see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC
Accepts the same parameters as the longest form of the constructor (i.e.
|
__nullFunc, deleteProperty, getThis, hashCode, hasProperty, isConstructor, isFunction, property, property, property, propertyAtIndex, propertyAtIndex, propertyNames, prototype, prototype
equals, getContext, isArray, isBoolean, isDate, isEqual, isFloat32Array, isFloat64Array, isInstanceOfConstructor, isInt16Array, isInt32Array, isInt8Array, isNull, isNumber, isObject, isStrictEqual, isString, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isUndefined, toBoolean, toFunction, toJSArray, toNumber, toObject, toString, valueHash, valueRef
public JSDate(JSContext ctx)
ctx
- The JSContext in which to create the date objectpublic JSDate(JSContext ctx, java.util.Date date)
ctx
- The JSContext in which to create the date objectdate
- The Date with which to initialize the objectpublic JSDate(JSContext ctx, java.lang.Long epoch)
ctx
- The JSContext in which to create the date objectepoch
- Milliseconds since since 1 January 1970 00:00:00 UTCpublic JSDate(JSContext ctx, java.lang.Integer... params)
ctx
- The JSContext in which to create the date objectparams
- FullYear, Month[, Date[, Hours[, Minutes[, Seconds[, Milliseconds]]]]]public static java.lang.Long now(JSContext ctx)
ctx
- The JavaScript contextpublic static java.lang.Long parse(JSContext ctx, java.lang.String string)
ctx
- The context into which to create the JavaScript date objectstring
- String representation of the datepublic static java.lang.Long UTC(JSContext ctx, java.lang.Integer... params)
ctx
- The context into which to create the JavaScript date objectparams
- FullYear, Month[, Date[, Hours[, Minutes[, Seconds[, Milliseconds]]]]]public java.lang.Integer getDate()
public java.lang.Integer getDay()
public java.lang.Integer getFullYear()
public java.lang.Integer getHours()
public java.lang.Integer getMilliseconds()
public java.lang.Integer getMinutes()
public java.lang.Integer getMonth()
public java.lang.Integer getSeconds()
public java.lang.Long getTime()
public java.lang.Integer getTimezoneOffset()
public java.lang.Integer getUTCDate()
public java.lang.Integer getUTCDay()
public java.lang.Integer getUTCFullYear()
public java.lang.Integer getUTCHours()
public java.lang.Integer getUTCMilliseconds()
public java.lang.Integer getUTCMinutes()
public java.lang.Integer getUTCMonth()
public java.lang.Integer getUTCSeconds()
public void setDate(java.lang.Integer value)
value
- Sets the day of the month for a specified date according to local time.public void setFullYear(java.lang.Integer value)
value
- Sets the full year (e.g. 4 digits for 4-digit years) for a specified date
according to local time.public void setHours(java.lang.Integer value)
value
- Sets the hours for a specified date according to local time.public void setMilliseconds(java.lang.Integer value)
value
- Sets the milliseconds for a specified date according to local time.public void setMinutes(java.lang.Integer value)
value
- Sets the minutes for a specified date according to local time.public void setMonth(java.lang.Integer value)
value
- Sets the month for a specified date according to local time.public void setSeconds(java.lang.Integer value)
value
- Sets the seconds for a specified date according to local time.public void setTime(java.lang.Long value)
value
- Sets the Date object to the time represented by a number of milliseconds since
January 1, 1970, 00:00:00 UTC, allowing for negative numbers for times prior.public void setUTCDate(java.lang.Integer value)
value
- Sets the day of the month for a specified date according to universal time.public void setUTCFullYear(java.lang.Integer value)
value
- Sets the full year (e.g. 4 digits for 4-digit years) for a specified date
according to universal time.public void setUTCHours(java.lang.Integer value)
value
- Sets the hour for a specified date according to universal time.public void setUTCMilliseconds(java.lang.Integer value)
value
- Sets the milliseconds for a specified date according to universal time.public void setUTCMinutes(java.lang.Integer value)
value
- Sets the minutes for a specified date according to universal time.public void setUTCMonth(java.lang.Integer value)
value
- Sets the month for a specified date according to universal time.public void setUTCSeconds(java.lang.Integer value)
value
- Sets the seconds for a specified date according to universal time.public java.lang.String toDateString()
public java.lang.String toISOString()
public java.lang.String toJSON()
public java.lang.String toTimeString()
public java.lang.String toUTCString()