--- id: parsedate title: parseDate Operator description: Use the parseDate operator to extract a date or time from a string and convert it to a timestamp in milliseconds. slug: /help/docs/search/search-query-language/parse-operators/parsedate/ canonical: https://www.sumologic.com/help/docs/search/search-query-language/parse-operators/parsedate/ --- The parseDate operator extracts a date or time from a string and provides a timestamp in milliseconds. :::note - To convert an epoch timestamp to a human-readable format, use the [`formatDate`](/docs/search/search-query-language/search-operators/formatdate) operator. - `parseDate` operator supports timestamp only in milliseconds. ::: ## Syntax * `parseDate(, )` * `parseDate(, , )` ## Rules * `strDate` must start with the characters to match with the `dateFormat` pattern. For example, "3/4/2005 other" but not "other 3/4/2005". * `dateFormat` is a pattern string, such as "MM/dd/yyyy HH:mm:ss a". A full list of the supported patterns can be found on [Java's simpledateformat](https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) documentation. * If you do not supply `timeZone`, the operator defaults to the time zone set in your [preferences](../../../get-started/account-settings-preferences.md). For a list of `timeZone` codes, see the [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). ## Examples ### Parse an ISO 8601 date string Given the date `2019-11-18T19:00:00.000-08:00` you'd specify the `dateFormat` as `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`: ```sumo | parseDate(date, "yyyy-MM-dd'T'HH:mm:ss.SSSXXX") as milliseconds ``` ### Parse a custom date format from a log field Given a log message such as: ``` instance of Win32_NTLogEvent { EventIdentifier = 100; Logfile = "Application"; RecordNumber = 894528; SourceName = "Bonjour Service"; TimeGenerated = "20170720000030.000000-000"; TimeWritten = "20170720000030.000000-000"; Type = "Error"; ... } ``` The following query returns TimeGenerated as a timestamp in milliseconds (in this example, 1500534030000): ```sumo | parse "TimeGenerated = \"*.000000-000" as dd | parseDate(dd, "yyyyMMddHHmmss") as milliseconds ``` ### Specify a time zone To parse a date string using a specific time zone: ```sumo | parse "TimeGenerated = \"*.000000-000" as dd | parseDate(dd, "yyyyMMddHHmmss", "etc/utc") as milliseconds ```