フィルターのクリア

read only time from date

3 ビュー (過去 30 日間)
Fragkiskos Nikolakis
Fragkiskos Nikolakis 2017 年 1 月 13 日
回答済み: Peter Perkins 2017 年 1 月 19 日
I have dates in format 'yyyy-mm-dd HH-MM-SS.FF'. I want to calculate something starting only when time is 12-00-00. How can i do that (reading only the time from the date)? Thanks

回答 (2 件)

Adam
Adam 2017 年 1 月 13 日
[Y,M,D,H,MN,S] = datevec(___)
seems like it would do this, more information in
doc datevec

Peter Perkins
Peter Perkins 2017 年 1 月 19 日
If you're using MATLAB R2014b or later, use datetime and timeofday:
>> t = datetime({'2017-01-19 11-35-12.34' '2017-01-19 12-25-23.45'},'Format','yyyy-MM-dd HH-mm-ss.SS')
t =
1×2 datetime array
2017-01-19 11-35-12.34 2017-01-19 12-25-23.45
>> timeofday(t) > hours(12)
ans =
1×2 logical array
0 1

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by