How to convert a number into a date

5 ビュー (過去 30 日間)
TSR
TSR 2020 年 3 月 24 日
コメント済み: TSR 2020 年 3 月 25 日
I have two sets of numbers (Representing same day of a GPS position time series),and I do not know the their types.I want to convert either of them and obtain the day/month/year. Type 1 ( 2017.23972602740 ) and Type 2 (52634).I tried datetime(x,'ConvertFrom','datenum') and datetime(x,'ConvertFrom','juliandate') but cannot obtain correct date. Please help.
  2 件のコメント
dpb
dpb 2020 年 3 月 24 日
See <gps/timsys.html> for the first.
AFAIK, TMW hasn't yet supplied a builtin conversion in datetime...
I don't recognize the second...
TSR
TSR 2020 年 3 月 24 日
Hello dpb,
Thank you for the information,it helped me to figure out the Type 2 (52634) . It is modified julian date.Therefore,using datetime(x,'ConvertFrom','modifiedjuliandate') we can obtain the date in format of day/month/year

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

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 3 月 24 日
Haven't figured out Type 1 yet, but based on this website, I think I've got a way to convert Type 2.
% GPS time
t = 52634;
tUnix = t+315964800;
dt = datetime(tUnix,"ConvertFrom","posixtime")
dt =
06-Jan-1980 14:37:14
  2 件のコメント
dpb
dpb 2020 年 3 月 24 日
I figured it had something like that, but haven't ever messed w/ any GPS stuff to have actual experience...
TSR
TSR 2020 年 3 月 25 日
Hi Cris,
type two is in modified julian dates
date= datetime(52634,'ConvertFrom','modifiedjuliandate')
date =
datetime
26-Dec-2002 00:00:00

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

カテゴリ

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