Skip to content
Reference > Methods

parseDate(text,format,timezone)

Definition

Long parseDate(String text, String format, String timezone)

Description

Converts a string to a unix epoch time. Returns a Long or null.

Parameter Definition

Name Type Description
text String String to parse
format String Pattern to expect string to be in, see java SimpleDateFormat for options
timezone String Timezone to expect string is in

Examples

Long r1 = parseDate("201505030-10:30:40.123","yyyyMMdd-HH:mm:ss.SSS","EST5EDT"); // r1 == 1432996240123
Long r2 = parseDate("Jan/03/1982-10:30:40","MMMM/dd/yyyy-HH:mm:ss","UTC"); // r2 == 378901840000