date
Contains functions for working with date and time
Constants
STYLE_FULL
: number = 0
STYLE_LONG
: number = 1
STYLE_MEDIUM
: number = 2
STYLE_SHORT
: number = 3
Functions
newDate(...)
- newDate()
- returns current date.
newDate(timestamp)
- returns date by given timestamp.
newDate(dateString)
- parses and returns date by given string.
newDate(pattern, dateString)
- parses and returns date by given string in pattern
format.
newDate(year, month, day)
- returns date by year, month and day.
newDate(year, month, day, hour, minute)
- returns date by year, month, day, hour and minute.
newDate(year, month, day, hour, minute, second)
- returns date by year, month, day, hour, minute and second.
Returns DateValue.
newFormat(...)
- newFormat()
- returns default date format.
newFormat(pattern)
- returns date format by given pattern.
newFormat(type)
- returns format: 0 - default, 1 - date, 2 - time, 3 - date and time.
newFormat(pattern, locale)
- returns date format by given pattern and locale.
newFormat(type, style)
- returns format: 0 - default, 1 - date, 2 - time, 3 - date and time. style
: 0 - full, 1 - long, 2 - medium, 3 - short.
Returns DateFormatValue.
formatDate(date, format = default)
- formats date by given format and returns string
Example
d = date(2016, 4, 8)
println formatDate(d, newFormat("yyyy/MM/dd")) // "2016/05/08"
parseDate(dateString, format = default)
- parses date from string by given pattern. Returns DateValue
Example
println parseDate("2016/05/08", newFormat("yyyy/MM/dd"))
toTimestamp(date)
- returns timestamp in milliseconds
Types
DateValue
DateFormatValue