Home Ask Login Register

Developers Planet

Your answer is one click away!

Rohit Singh February 2016

Convert the date from PST to IST and output the difference in hour

Is there any way to automatically convert PST Date in to IST date. When I put date in column E and F I have dates in PST time zone. I want to convert in IST time zone. after i want output in column G. the difference between two dates.

I have solved this with excel formula but I want this to done with VBA.

For eg.

> E                           F                      G             
1/14/2016  2:49:00 PM     1/14/2016  2:57:00 PM          0:08

1/14/2016  2:45:00 PM     1/14/2016  2:59:00 PM          0:09 


Gary's Student February 2016


Sub qwerty()
   Dim pst As Date, ist As Date

   pst = DateSerial(2016, 1, 14) + TimeSerial(14, 49, 0)
   ist = pst + TimeSerial(13, 30, 0)
   MsgBox pst & vbCrLf & ist
End Sub

Post Status

Asked in February 2016
Viewed 1,827 times
Voted 14
Answered 1 times


Leave an answer

Quote of the day: live life