how to convert UTC to IST(indian standard time)

15 views (last 30 days)
suppose i have a column of UTC given below i want to convert into IST so i want to add +5:30 hrs to my UTC column,so how could i convert.
08:29:54
08:30:55
08:31:56
08:32:57
08:33:58
08:34:59
09:00:00
09:01:01

Accepted Answer

Star Strider
Star Strider on 6 Feb 2020
If you have R2014b or later, datetime will do this easily.
Try this:
TUCT = {'08:29:54'
'08:30:55'
'08:31:56'
'08:32:57'
'08:33:58'
'08:34:59'
'09:00:00'
'09:01:01'};
T = datetime(TUCT, 'InputFormat','HH:mm:ss', 'TimeZone','UCT')
T.TimeZone = 'Asia/Kolkata'
producing:
T =
8×1 datetime array
06-Feb-2020 08:29:54
06-Feb-2020 08:30:55
06-Feb-2020 08:31:56
06-Feb-2020 08:32:57
06-Feb-2020 08:33:58
06-Feb-2020 08:34:59
06-Feb-2020 09:00:00
06-Feb-2020 09:01:01
T =
8×1 datetime array
06-Feb-2020 13:59:54
06-Feb-2020 14:00:55
06-Feb-2020 14:01:56
06-Feb-2020 14:02:57
06-Feb-2020 14:03:58
06-Feb-2020 14:04:59
06-Feb-2020 14:30:00
06-Feb-2020 14:31:01
  11 Comments
MONICA RAWAT
MONICA RAWAT on 14 Mar 2020
i tried using this but its showing as error that it is unable to convert
Star Strider
Star Strider on 14 Mar 2020
As Walter Roberson mentioned:
TUCT = "08:29:54.0127";
T = datetime(TUCT, 'InputFormat','HH:mm:ss.SSSS', 'TimeZone','UCT', 'Format','HH:mm:ss.SSSS')
T.TimeZone = 'Asia/Kolkata'
produces:
T =
datetime
13:59:54.0127

Sign in to comment.

More Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!