Calculating Time and Date with different Zone

Page 1 of 1

3 Replies - 6014 Views - Last Post: 22 August 2007 - 09:53 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=31894&amp;s=37bcda9529c05584c8513a39cdc933d9&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 priya2345

Reputation: 0
• Posts: 8
• Joined: 19-August 07

Calculating Time and Date with different Zone

Posted 19 August 2007 - 02:34 AM

Hello,

I want to create a tool to calculate the new date and time according to the zone selected

For example
1. how do I calculate the new time by adding 2 hrs and 20 minutes to the current time
2. How do I calculate the new date and time for different zones like EST

My system follows the IST

I tried using DateTime, Now but couldn't get the correct answes

Is This A Good Question/Topic? 0

Replies To: Calculating Time and Date with different Zone

#2 PsychoCoder

Reputation: 1659
• Posts: 19,853
• Joined: 26-July 07

Re: Calculating Time and Date with different Zone

Posted 19 August 2007 - 12:39 PM

Research the DataAdd, DateDiff, DatePart function in VB6. Once you have done that and tried writing some code to accomplish this and run into problems, then post your code here with a nice explanation of your problem and we'll help

#3 priya2345

Reputation: 0
• Posts: 8
• Joined: 19-August 07

Re: Calculating Time and Date with different Zone

Posted 20 August 2007 - 05:53 AM

Thanks for the ideas

I tried with DateAdd and was successful in calculating the Time
I calculated the EST by subtracting 570 mins(9.30 hrs) from the current IST time

Now I am stuck on calculating the new date for ex.
If the IST is 6:00 AM of Aug 20 then the EST is 8:30 PM of Aug 19.
I am getting the 8:30 part correct, but unable to get Aug 19 as the new date according to EST

Any ideas on this.

Thanks

#4 born2c0de

• printf("I'm a %XR",195936478);

Reputation: 187
• Posts: 4,673
• Joined: 26-November 04

Re: Calculating Time and Date with different Zone

Posted 22 August 2007 - 09:53 AM

I think that will be taken care of if you specify the Date as well instead of just the time in the Date variable.