필터 지우기
필터 지우기

how to convert UTC to IST(indian standard time)

조회 수: 13 (최근 30일)
MONICA RAWAT
MONICA RAWAT 2020년 2월 6일
댓글: Star Strider 2020년 3월 14일
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

채택된 답변

Star Strider
Star Strider 2020년 2월 6일
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
MONICA RAWAT
MONICA RAWAT 2020년 3월 14일
i tried using this but its showing as error that it is unable to convert
Star Strider
Star Strider 2020년 3월 14일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by