Comments

3 comments

  • Avatar
    Kumar Saurabh

    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

     

     

  • Avatar
    Charlie Pye

    How would I do this with a date formatted as yyyy-MM-dd HH:mm:ss ?  Without milliseconds.

  • Avatar
    Christian Beedgen

    try this:

    | toMillis(parseDate(datestr, "yyyy-MM-dd HH:mm:ss")) as dateInMillis

     

    chr.

Please sign in to leave a comment.