I have a timestamp string as follows:
String build_time=2017-11-20T21:27:03Z
I want to convert it into epoch time in milliseconds as per the PST time zone such that my result is:
long build_time_ms=1511299623000
How can I do this?
I have a timestamp string as follows:
String build_time=2017-11-20T21:27:03Z
I want to convert it into epoch time in milliseconds as per the PST time zone such that my result is:
long build_time_ms=1511299623000
How can I do this?
You can achieve this using java's
java.time.*
package. Below is working script and output from running groovy via docker. I haven't tried this within Jenkins though, and script may require adding appropriatedef
statements to avoid pipeline serialization issuesScript
Script output, running in groovy REPL
Also, in your example you're giving result of 1511299623000 ms, which seems to be 24 hours ahead of timestamp, looking at javascript console, with inputs from your example