Skip to content
Reference > Methods

datePart(unixEpochMillis,yMdHmsS,timezone)

Definition

Long datePart(Number unixEpochMillis, String yMdHmsS, String timezone)

Description

Converts a datetime to a time as number of milliseconds past midnight in the given timezone. Returns a Long that is the number of milliseonds since midnight in supplied timezone. Will be between 0 and 86,400,000

Parameter Definition

Name Type Description
unixEpochMillis Number Number of milliseconds since 1/1/1970 in UTC timezone
yMdHmsS String 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

Long r1 = datePart(100000000,"y","EST5EDT"); // r1 == 18000000
Long r2 = datePart(100000000,"HmsS","UTC"); // r2 == 13600000