US - time stamp
hello,
we are creating swing based desktop application, when i insert data into database i need to insert US current time stamp, not any other country local time stamp , though this application is used in different countries.
Can any one of you let me know how to get US date and time or time stamp please ?
thanking you in advance...
[359 byte] By [
ram_76uka] at [2007-11-27 8:23:41]

# 1
Please find the sample code here. Please remember that US has different times in different regions.
public static void processTime(String timeString, String tzString)
{
TimeZone tz = TimeZone.getTimeZone(tzString);
if (tz == null)
{
System.out
.println("** Timezone " + tzString + " not recognized **");
return;
}
try
{
SimpleDateFormat formatter = new SimpleDateFormat(
"EEE MMM dd HH:mm:ss zzz yyyy");
Date val = formatter.parse(timeString);
formatter.setTimeZone(tz);
System.out.println("Date: " + formatter.format(val));
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
Date date = Calendar.getInstance().getTime();
processTime(date.toString(),"PST"); //Pacific Standard time
processTime(date.toString(),"EST"); //Eastern Standard time
processTime(date.toString(),"GMT-6"); //This can be used to evaluate the time anywhere in the world
}