[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem parsing time out of datetime object
From: |
PhilipNienhuis |
Subject: |
Re: problem parsing time out of datetime object |
Date: |
Fri, 20 Oct 2017 12:41:16 -0700 (MST) |
AG wrote
> I am trying to parse a datetime string into two pieces, date and time, and
> I'm trying to figure out why this code does not work. According to the
> docs
> it seems that a call to rem on a datetime will give you the time but it
> doesn't seem to do that.
>
> dt_num = datenum('2013/05/29 00:00:00','YYYY/DD/MM HH:MM:SS')
>
> d_num = floor(dt_num)
> t_num = rem(dt_num,1)
>
> datestr(d_num) ## ans = 05-Jan-2013 (RIGHT!)
> datestr(t_num) ## ans = 31-Dec--001 (WRONG)
Seems perfectly OK to me. What else would you expect for a date in the year
0, month 0, day 0? :-)
But perhaps you meant:
>> datestr (t_num, 13)
ans = 00:00:00
(try "help datestr" to see datestr's output options)
Philip
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- problem parsing time out of datetime object, AG, 2017/10/20
- problem parsing time out of datetime object, AG, 2017/10/20
- Re: problem parsing time out of datetime object,
PhilipNienhuis <=
- Re: problem parsing time out of datetime object, Nicholas Jankowski, 2017/10/20
- Re: problem parsing time out of datetime object, PhilipNienhuis, 2017/10/20
- Re: problem parsing time out of datetime object, Nicholas Jankowski, 2017/10/20
- Re: problem parsing time out of datetime object, AG, 2017/10/20
- Re: problem parsing time out of datetime object, Nicholas Jankowski, 2017/10/20
- Re: problem parsing time out of datetime object, Thomas D. Dean, 2017/10/21
- Re: problem parsing time out of datetime object, Andreas Weber, 2017/10/21
- Re: problem parsing time out of datetime object, AG, 2017/10/22