Last active
June 10, 2020 07:51
-
-
Save vitran96/0bdc974d9edddc1e0651b53353bc6906 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.SimpleDateFormat; | |
import java.util.Date; | |
public class JavaTimestampTest { | |
public static void main(String []args){ | |
// long timestamp = new Date().getTime(); | |
long timestamp = 1_591_768_420_177L - 8_610_000_000L; | |
Date date = new Date(timestamp); | |
// F - increase by every 7 days of the month | |
// W - increase by sunday of the month | |
// String format = "yyyy-MM-dd'T'HH:mm:ss'.'SSSZ yyMM"; | |
String format = "w W F E dd-MM-yyyy'T'HH:mm:ss'.'SSSZ"; | |
SimpleDateFormat formatter = new SimpleDateFormat(format); | |
String result = formatter.format(date); | |
System.out.println("Timestamp: " + timestamp); | |
System.out.println("Format: " + format); | |
System.out.println("Result: " + result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment