フィルターのクリア

How to add a given timestamp to midnight?

4 ビュー (過去 30 日間)
That Guy
That Guy 2020 年 11 月 9 日
回答済み: Walter Roberson 2020 年 11 月 9 日
Write a function named getTimePeriodRepresentation which receives a float as input. The float received by the function represents the timestamp (seconds since midnight) of an observation as well as the time period interval p that must be used to generate a time period string. The function returns the Nth-minute time period of the observation in HH:MM AM/PM format. The value of p (Nth-minute) can be 5, 15, 30, or 60.
function is getTimePeriodRepresentation(timestamp, p)
input into the function: (300.125, 5) returns : '12:05 AM'
(26850.431, 60) returns: '07:00 AM'
(49550.032, 15) returns: '01:45 PM'
(49550.032, 30) returns: '01:30 PM'
Im completely lost on this queston please help!

採用された回答

Walter Roberson
Walter Roberson 2020 年 11 月 9 日
base = datetime('today', 'Format', 'hh:mm a')
Now add time offsets to base.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by