Skip to content

Instantly share code, notes, and snippets.

@vkolodrevskiy
Last active December 30, 2015 18:59
Show Gist options
  • Save vkolodrevskiy/7871100 to your computer and use it in GitHub Desktop.
Save vkolodrevskiy/7871100 to your computer and use it in GitHub Desktop.
getting pst time
package com.viktor;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
/**
* TODO: add description
*
* @author vkolodrevskiy
*/
public class PstTimeTest {
public static void main(String args[]) {
System.out.println(getCurrentPstTime());
}
private static String getCurrentPstTime() {
Date startTime = new Date(); // current date time
TimeZone pstTimeZone = TimeZone.getTimeZone("America/Los_Angeles");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setTimeZone(pstTimeZone);
return dateFormat.format(startTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment