Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java JavaSE6
Hi all,
 
This is my first Post, regarding time zone conversion.
 
my requirement : i am getting date in string format here date is : "01/16/2013 6:00 PM". i need to trigger one job at this time. here user is in US(timezone : America/Regina[GMT -06:00]) and server is in INDIa(Asia/Calcutta[GMT +5:30]).
 
user assuming that the job is trigger at 01/16/2013 6:00 PM of his local time, for that i have to convert the us time in to IST and stored in the server to trigger the job in server.
 
here user selected time is : "01/16/2013 6:00 PM"
difference bt timezones : 11:30 hr ( India is 11:00 hr ahead)
so user time in server(IST) is : "01/17/2013 5:30 AM"
 
how to achive this functionality with a simple method which takes date as string and two timezones one is server and another one is user timezone.
 
please help me.
 
Thanks in advance..: )
Posted 13-Jan-13 21:40pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Convert the strings to proper DateTime objects and adjust them to UTC values. The times will then be valid at both the client and server end. The only time you need to apply the time zone value is when the time is displayed to the user; internally all date and time values should be held as UTC. Take a look at the Date[^], and other associated classes.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 359
1 Sergey Alexandrovich Kryukov 355
2 CPallini 335
3 BillWoodruff 324
4 OriginalGriff 237
0 OriginalGriff 5,050
1 CPallini 4,225
2 Sergey Alexandrovich Kryukov 3,639
3 George Jonsson 2,911
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100