skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

▼
 
  • RSS
  • Twitter
Sunday, October 21, 2012

Getting Timezone based Timestamp

Posted by Raju Gupta at 1:00 PM – 0 comments
 
It is used to find the Timestamp based on the given Timezone

//Creating format based on the need
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
//Set the Timezone 
dateFormat.setTimeZone(clientTimeZone);
String clientTime = dateFormat.format(date);
Date date2 = new Date(clientTime);
//
System.out.println(date2);

Labels: Java Date and Time Example

Leave a Reply

Newer Post Older Post
Subscribe to: Post Comments ( Atom )
  • Popular
  • Recent
  • Archives
Powered by Blogger.
 
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger