Uh oh! We couldn’t find any match.

Please try other search keywords.

Bixby Developer Center

Guides

dates

Provides date-time functions. Useful when using the DateTime library capsule.

dates.durationFromMilliseconds(milliseconds) ⇒ DurationPeriod

Convert a duration (milliseconds) to a DurationPeriod (structure)

Kind: Static method of dates
Returns: DurationPeriod - Object with properties

  • periodDays
  • periodHours
  • periodMinutes
  • periodSeconds
  • periodMilliseconds
ParameterTypeDescription
millisecondsZonedDateTimeMilliseconds since the beginning of the epoch

dates~ZonedDateTime

Kind: Inner class of dates
Access: Public

new ZonedDateTime(timeZoneIdOrGeoPoint, [millisecondsFromEpoch])

Returns: ZonedDateTime - Immutable object containing a representation of a date-time with a timezone. Use instead of the native Date object.

ParameterTypeDefaultDescription
timeZoneIdOrGeoPointString \ObjectEither a timezone ID string, or a GeoPoint object with latitude and longitude properties. For a timezone, use a valid IANA region-based time zone ID such as "America/Los_Angeles", or a valid offset from UTC such as "UTC+01:00".
[millisecondsFromEpoch]IntegernowThe number of milliseconds since the start of the UNIX epoch, January 1 1970 at 00:00:00 UTC

ZonedDateTime.getMillisFromEpoch() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Milliseconds from start of epoch of the specified dateTime.
Access: Public

ZonedDateTime.getTimeZoneId() ⇒ String

Kind: Instance method of ZonedDateTime
Returns: String - Timezone ID of the specified timezone
Access: Public

ZonedDateTime.getDateTime() ⇒ Object

Kind: Instance method of ZonedDateTime
Returns: Object - DateTime object with date and time properties
Access: Public

ZonedDateTime.getDayOfWeek() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Named day of the week Access: Public

ZonedDateTime.getYear() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Year of the specified date
Access: Public

ZonedDateTime.getMonth() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Month of the specified date Access: Public

ZonedDateTime.getDay() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Day of the specified date
Access: Public

ZonedDateTime.getHour() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Hour of the specified time
Access: Public

ZonedDateTime.getMinute() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Minute of the specified time
Access: Public

ZonedDateTime.getSecond() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Second of the specified time
Access: Public

ZonedDateTime.getMillisecond() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Millisecond of the specified time
Access: Public

ZonedDateTime.getTimeZoneOffset() ⇒ Integer

Kind: Instance method of ZonedDateTime
Returns: Integer - Timezone offset, in seconds, of the specified timezone
Access: Public

ZonedDateTime.isDST() ⇒ Boolean

Kind: Instance method of ZonedDateTime
Returns: Boolean - Returns true if the specified timezone uses daylight savings time at the specified date and time, otherwise false
Access: Public

ZonedDateTime.withYear(year) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified year set
Access: Public

ParameterType
yearInteger

ZonedDateTime.withMonth(month) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified month set
Access: Public

ParameterType
monthInteger

ZonedDateTime.withDay(day) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified day set
Access: Public

ParameterType
dayInteger

ZonedDateTime.withHour(hour) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified hour set
Access: Public

ParameterType
hourInteger

ZonedDateTime.withMinute(minute) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified minute set
Access: Public

ParameterType
minuteInteger

ZonedDateTime.withSecond(second) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified second set
Access: Public

ParameterType
secondInteger

ZonedDateTime.withMillisecond(millisecond) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified millisecond set
Access: Public

ParameterType
millisecondInteger

ZonedDateTime.withZoneSameInstant(timeZoneId) ⇒ ZonedDateTime

Construct a new ZonedDateTime for the same instant in time, but translated to a different timezone

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified time zone applied
Access: Public

ParameterType
timeZoneIdString

ZonedDateTime.withZoneSameLocal(timeZoneId) ⇒ ZonedDateTime

Construct a new ZonedDateTime for the same local dateTime, but translated to a different timezone

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with specified time zone applied
Access: Public

ParameterType
timeZoneIdString

ZonedDateTime.plusYears(years) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by years
Access: Public

ParameterType
yearsInteger

ZonedDateTime.plusMonths(months) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by months
Access: Public

ParameterType
monthsInteger

ZonedDateTime.plusDays(days) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by days
Access: Public

ParameterType
daysInteger

ZonedDateTime.plusHours(hours) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by hours
Access: Public

ParameterType
hoursInteger

ZonedDateTime.plusMinutes(minutes) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by minutes
Access: Public

ParameterType
minutesInteger

ZonedDateTime.plusSeconds(seconds) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by seconds
Access: Public

ParameterType
secondsInteger

ZonedDateTime.plusMilliseconds(milliseconds) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by milliseconds
Access: Public

ParameterType
millisecondsInteger

ZonedDateTime.plusDuration(duration) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object incremented by the given duration
Access: Public

ParameterType
durationObject

ZonedDateTime.minusYears(years) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by years
Access: Public

ParameterType
yearsInteger

ZonedDateTime.minusMonths(months) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by months
Access: Public

ParameterType
monthsInteger

ZonedDateTime.minusDays(days) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by days
Access: Public

ParameterType
daysInteger

ZonedDateTime.minusHours(hours) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by hours
Access: Public

ParameterType
hoursInteger

ZonedDateTime.minusMinutes(minutes) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by minutes
Access: Public

ParameterType
minutesInteger

ZonedDateTime.minusSeconds(seconds) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by seconds
Access: Public

ParameterType
secondsInteger

ZonedDateTime.minusMilliseconds(milliseconds) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by milliseconds
Access: Public

ParameterType
millisecondsInteger

ZonedDateTime.minusDuration(duration) ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object decremented by the given duration
Access: Public

ParameterType
durationObject

ZonedDateTime.atStartOfDay() ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with time adjusted to the start of the current day

ZonedDateTime.atEndOfDay() ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with time adjusted to the end of the current day

ZonedDateTime.compareTo(other) ⇒ Integer

Compares one ZonedDateTime to another. Comparison is based solely off of the instant in time, regardless of timezone.

Kind: Instance method of ZonedDateTime
Returns: Integer - 0 when other is identical, -1 when other is later, 1 when other is earlier.

ParameterTypeDescription
otherZonedDateTimeThe ZonedDateTime to compare

ZonedDateTime.isEqualTo(other) ⇒ Boolean

Compares one ZonedDateTime to another. Comparison is based solely off of the instant in time, regardless of timezone.

Kind: Instance method of ZonedDateTime
Returns: Boolean - Returns true when other is identical, false otherwise.

ParameterTypeDescription
otherZonedDateTimeThe ZonedDateTime to compare

ZonedDateTime.isBefore(other) ⇒ Boolean

Compares one ZonedDateTime to another. Comparison is based solely off of the instant in time, regardless of timezone.

Kind: Instance method of ZonedDateTime
Returns: Boolean - Returns true when other is later, false otherwise

ParameterTypeDescription
otherZonedDateTimeThe ZonedDateTime to compare.

ZonedDateTime.isBeforeOrEqualTo(other) ⇒ Boolean

Compares one ZonedDateTime to another. Comparison is based solely off of the instant in time, regardless of timezone.

Kind: Instance method of ZonedDateTime
Returns: Boolean - Returns true when other is later or identical, false otherwise.

ParameterTypeDescription
otherZonedDateTimeThe ZonedDateTime to compare.

ZonedDateTime.isAfter(other) ⇒ Boolean

Compares one ZonedDateTime to another. Comparison is based solely off of the instant in time, regardless of timezone.

Kind: Instance method of ZonedDateTime
Returns: Boolean - Returns true when other is earlier, false otherwise

ParameterTypeDescription
otherZonedDateTimeThe ZonedDateTime to compare

ZonedDateTime.isAfterOrEqualTo(other) ⇒ Boolean

Compares one ZonedDateTime to another. Comparison is based solely off of the instant in time, regardless of timezone.

Kind: Instance method of ZonedDateTime
Returns: Boolean - Returns true when other is earlier or identical, false otherwise.

ParameterTypeDescription
otherZonedDateTimeThe ZonedDateTime to compare

ZonedDateTime.durationUntil(other, unit) ⇒ DurationPeriod

Get the duration from this ZonedDateTime to another

Kind: Instance method of ZonedDateTime
Returns: DurationPeriod - Object with property for unit (if provided), or properties

  • periodYears
  • periodMonths
  • periodDays
  • periodHours
  • periodMinutes
  • periodSeconds
  • periodMilliseconds
ParameterTypeDescription
otherZonedDateTimeThe ZonedDateTime to compare
unitStringThe unit to use (can be Years, Months, Days, Hours Minutes, Seconds, Millis)

ZonedDateTime.clone() ⇒ ZonedDateTime

Kind: Instance method of ZonedDateTime
Returns: ZonedDateTime - New object with the same timezone and instant in time

ZonedDateTime.toIsoString() ⇒ String

Kind: Instance method of ZonedDateTime
Returns: String - The specified instant in time and timezone, formatted as an ISO 8601 combined date and time

ZonedDateTime.toString() ⇒ String

Kind: Instance method of ZonedDateTime
Returns: String - The specified instant in time and timezone, formatted using the default pattern, Java's DateTimeFormatter.ISO_ZONED_DATE_TIME.

ZonedDateTime.toJSON() ⇒ String

Kind: Instance method of ZonedDateTime
Returns: String - The specified instant in time and timezone, formatted using the default pattern, Java's DateTimeFormatter.ISO_ZONED_DATE_TIME

ZonedDateTime.format([pattern]) ⇒ String

Kind: Instance method of ZonedDateTime
Returns: String - The specified instant in time and timezone, formatted using the pattern. If the pattern is null, will use Java's DateTimeFormatter.ISO_ZONED_DATE_TIME.

ParameterTypeDescription
[pattern]StringA pattern as specified by Java's DateTimeFormatter

ZonedDateTime.of([timezone], [year], [month], [day], [hour], [minute], [second], [millisecond]) ⇒ ZonedDateTime

Returns a new dates.ZonedDateTime with the arguments provided. All arguments are optional. If the first argument is a string, it's assumed to be the timeZoneId. Otherwise, the default user time zone is used and all other inputs must be integer values (month and day are 1-based, others are 0-based). If no arguments are provided, then it's equivalent to calling dates.ZonedDateTime.now().

Kind: Static method of ZonedDateTime
Returns: ZonedDateTime - A new object using all available date-time params.

ParameterTypeDefaultDescription
[timezone]StringA timezone ID. If null, uses default timezone.
[year]Integer0
[month]Integer1
[day]Integer1
[hour]Integer0
[minute]Integer0
[second]Integer0
[millisecond]Integer0 

ZonedDateTime.fromDate(date) ⇒ ZonedDateTime

Kind: Static method of ZonedDateTime
Returns: ZonedDateTime - A new object at the start of the specified date, in the default timezone

ParameterTypeDescription
dateDateAn object with properties for year, month, and day

ZonedDateTime.fromDateTime(dateTime) ⇒ ZonedDateTime

Kind: Static method of ZonedDateTime
Returns: ZonedDateTime - A new object at the start of the specified date and time, in the default timezone

ParameterTypeDescription
dateTimeDateTimeAn object with properties for date and time

ZonedDateTime.parseDate(input, [pattern], [timeZoneId]) ⇒ ZonedDateTime

Kind: Static method of ZonedDateTime
Returns: ZonedDateTime - A new object at the beginning of the specified date, either in the specified timezone or in the default timezone

ParameterTypeDescription
inputStringThe string to parse
[pattern]StringThe pattern to use. See here for details on supported patterns.
[timeZoneId]StringThe timezone ID

ZonedDateTime.parseTime(input, pattern, [timeZoneId]) ⇒ ZonedDateTime

Kind: Static method of ZonedDateTime
Returns: ZonedDateTime - A new object at the specified time of the current date, either in the specified timezone or in the default timezone

ParameterTypeDescription
inputStringThe string to parse.
[pattern]StringThe pattern to use. See here for details on supported patterns.
[timeZoneId]StringThe timezone ID.

ZonedDateTime.parseDateTime(input, pattern, [timeZoneId]) ⇒ ZonedDateTime

Kind: Static method of ZonedDateTime
Returns: ZonedDateTime - A new object at the specified date and time, either in the specified timezone or in the default timezone

ParameterTypeDescription
inputStringThe string to parse
[pattern]StringThe pattern to use. See here for details on supported patterns.
[timeZoneId]StringThe timezone ID

~Convenience method for creating a new dates.ZonedDateTime for the current date-time. An optional timeZoneId or geoPoint can be provided, otherwise the default user time zone is used.(param) ⇒ Object

Kind: inner method of dates
Returns: Object - Current date-time for the specified timezone or in the provided geo-point location.
Access: Public

ParameterTypeDescription
paramString \ObjectEither a timezone ID string, or a GeoPoint object with latitude and longitude properties. If null, uses default timezone.