Skip to content
Reference > Methods

datePartNum(unixEpochMillis,part,timezone)

Definition

Integer datePartNum(Number unixEpochMillis, String part, String timezone)

Description

Returns part of a date as an integer value based on some supplied time in milliseconds since the Unix epoch (1/1/1970) in the given timezone.

Parameter Definition

Name Type Description
unixEpochMillis Number Number of milliseconds since 1/1/1970 in UTC timezone
part String Date fields to return:
  • "y"-year
  • "M"-month
  • "d"-day
  • "H"-hour
  • "m"-minute
  • "s"-Second
  • "S"-millisecond
timezone String Timezone to return extracted fields in

Examples

1
2
3
Integer r1 = datePartNum(0,"y","UTC"); // r1 == 1970
Object r2 = datePartNum(0,"HmsS","UTC"); // r2 == null
Integer r3 = datePartNum(100000000,"E","EST5EDT"); // r3 == 5