フィルターのクリア

How to calculate time elapsed (time in GMT format)

3 ビュー (過去 30 日間)
Kanakaiah Jakkula
Kanakaiah Jakkula 2017 年 12 月 16 日
コメント済み: Star Strider 2017 年 12 月 16 日
Hi,
I have below two different times, and want to calculate time elapsed:
2017-12-13-T16:00:23.488+08:00
2017-12-13-T16:02:24.982+08:00
Many thanks in advance,

採用された回答

Star Strider
Star Strider 2017 年 12 月 16 日
One approach:
v = {'2017-12-13-T16:00:23.488+08:00'
'2017-12-13-T16:02:24.982+08:00'};
T = datenum(v, 'yyyy-mm-dd-THH:MM:SS.FFF')
dT = etime(datevec(T(2)),datevec(T(1))) % Elapsed Time In Seconds
dT =
121.49
NOTE In theory, datetime can do something like this, however it will not import your data using the date format, and refuses to automatically recognise the time zone. I suppose datetime has its uses, but they frequently elude me. Anyway, the ‘classic’ functions work.
  4 件のコメント
Kanakaiah Jakkula
Kanakaiah Jakkula 2017 年 12 月 16 日
Thanks Sir. It works.
Star Strider
Star Strider 2017 年 12 月 16 日
As always, my pleasure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by