How do I parse a date string?
How do I parse the following?
rangeStartTime='2013-10-09 09:14:49,950',
-
It is a two step process - first I had to extract the date string from the log line using a parse operator. parseDate converts the String to a Date object and use toMillis to translate a date into millis. parseDate operator supports the full format supported by java as described http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html (if the link does not work, just google for "java date formatter")
* | parse "*-0700" as datestr
| toMillis(parseDate(datestr, "yyyy-MM-dd HH:mm:ss,SSS")) as dateInMillis
Please sign in to leave a comment.
Comments
3 comments