Java SimpleDateFormat format Date to String as "2020.02.25 AD at 09:41:39 PST"
import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static void main(String[] args) throws Exception { Locale currentLocale = new Locale("en", "US"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd G 'at' hh:mm:ss z", currentLocale); Date today = new Date(); String result = formatter.format(today); System.out.println("Locale: " + currentLocale.toString()); System.out.println("Result: " + result); }/*from www .j a v a2s. c o m*/ }