Official ZPE/YASS documentationDate object


Much like what happened with the image object, the date object encapsulates and provides access to a date value ensuring type safety and simplifing its use.

The date object provides several core functionalities that make it useful to work with.

Date object functions

The following is a list of internal functions the ZPEImage object exposes. All functions are ZPEObjectNativeFunctions unless specified therefore run in native code.

set_date(string date[, string format) ⇒ boolean
Sets the date stored within the object. The format helps the system to decide what format the date value is in. If the format parameter is omitted, the format becomes yyyy-MM-dd.
set_to_now() ⇒ string
Sets the date stored within the object to now. It then returns the date as a string.
convert_to_string() ⇒ string
Outputs the date in a specified format to a string.
date_diff(object d1[, string format]) ⇒ int
Compares this date against another. The format value is optional but if specified it can have one of four values: hours, minutes, seconds or days. This lets the function know what to return the number of. By default the format is days.
hour() ⇒ int
Returns the hour value of the date.
minute() ⇒ int
Returns the minute value of the date.
second() ⇒ int
Returns the second value of the date.
day() ⇒ int
Returns the day value of the date.
month() ⇒ int
Returns the month value of the date.
year() ⇒ int
Returns the year value of the date.
time() ⇒ int
Returns a long integer representing the current epoch time.
Added in 1.8.7
Feedback 👍
Comments are sent via email to me.