Created
January 13, 2021 22:44
-
-
Save themarcelor/f7f7eceb7b2a70d2a72f6a655c1c5cdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import hudson.Util; | |
currentTime = new Date().getTime()/1000 as Integer | |
Date date = new Date(currentTime * 1000L); | |
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z"); | |
String formatted = format.format(date); | |
println(formatted) | |
//def jenkinsTimeMillis = System.currentTimeMillis() | |
def jenkinsTimeMillis = (new Date().getTime()) + 3600000 | |
//println(jenkinsTimeMillis) | |
Date date2 = new Date(jenkinsTimeMillis); | |
DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z"); | |
String formatted2 = format2.format(date2); | |
println(formatted2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment