Date Conversion From PDT/PST (to) IST

pavin

Active Member
Joined
Jan 20, 2009
Messages
308
Hi All,

I'm looking for a Date(in text format) to convert from PDT/PST to IST using Excel/VBA. Kindly help. Thank you.

Example:
"Tue Jun 30 11:30:00 PDT 2015"

Result:
"Wed Jul 01 12:00:00 IST 2015"
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Code:
Function PDTtoIST(r As String) As String
Dim d, dv
d = Split(r)
dv = DateValue(d(1) & " " & d(2) & " " & d(5)) + TimeValue(d(3))
dv = DateAdd("n", 1470, dv)
PSTtoIST = Format(dv, "ddd mmm dd hh:mm:ss ""IST"" yyyy")
End Function
 
Last edited:
Upvote 0
Amazing....works fine. Many Thanks

I created something like the following.

=TEXT(CONCATENATE(TEXT(DATE(RIGHT(A2,4),MONTH(1&LEFT(MID(A2,5,3),3)),MID(A2,9,2)),"mm/dd/yyyy")&" "&TEXT(TIMEVALUE(MID(A2,FIND(" ",A2,9)+1,8)),"hh:mm:ss"))+TIME(12,30,0),"ddd mmm dd hh:mm:ss AM/PM ""IST"" yyyy")
 
Last edited:
Upvote 0
Amazing....works fine.
I am wondering if Scott's code will always work correctly for you? Your thread title indicates the date/time being converted could be either daylight saving time or standard time and that the date/time it is being converted to is always standard date/time. Scot's code does not handle both standard and daylight saving time as the value to convert from. Did you really need to distinguish between the two? If so, are you really only converting to a standard time value only? I would also note that although Scott's function is named to suggest it is converting standard time to standard time, it appears to actually be converting daylight savings time to standard time as that is what your Example/Result says your two times are.
 
Last edited:
Upvote 0
Good call.

Code:
Function PTtoIST(r As String) As String
Dim d, dv
d = Split(r)
dv = DateValue(d(1) & " " & d(2) & " " & d(5)) + TimeValue(d(3))
dv = DateAdd("n", IIf(d(4) = "PDT", 1470, 1530), dv)
PTtoIST = Format(dv, "ddd mmm dd hh:mm:ss ""IST"" yyyy")
End Function


Excel 2010
AB
1Tue Jun 30 11:30:00 PDT 2015Wed Jul 01 12:00:00 IST 2015
2Tue Jun 30 11:30:00 PST 2015Wed Jul 01 13:00:00 IST 2015
Sheet1
Cell Formulas
RangeFormula
B1=PTtoIST(A1)
B2=PTtoIST(A2)
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top