Last active
December 30, 2015 18:59
-
-
Save vkolodrevskiy/7871100 to your computer and use it in GitHub Desktop.
getting pst time
This file contains hidden or 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
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