MATLAB Answers

Translated by

이 페이지의 내용은 영어에서 자동 번역되었습니다. 자동 번역 기능을 해제하려면 "<a class="turn_off_mt" href="#">여기</a>"를 클릭하십시오.

0

date and time format change

Asked by Charles on 1 May 2019
Latest activity Commented on by Peter Perkins
on 9 May 2019
Accepted Answer by dpb
i have a cell n x 2 table array. The first column containd dateas in the format of
'yyyy-MM-dd''T''HH:mm:ss.SSSSSSSSS''Z'''
I wish to change this to the following format
20130501000000, = 'YYYMMDD000000', which is '%Y%m%d%H%M%S'
I will then want to change the table array to a text file
I was hoping to use something like this to change the format. Any guidance would help.
New_datetime_new = datetime(EUR_USD.Date,'inputformat','yyyy-MM-dd''T''HH:mm:ss.SSSSSSSSS''Z''');

  3 Comments

@ Charles: please upload the cell array in a .mat file by clicking the paperclip button.
See .matf ile attached. i wish to change the date format to that in the .txt file. I wish to retain the close price column and in fact make two colums of closing price and rhenc onvert this to the .txt file
dpb
on 1 May 2019
What is the time zone???
You don't separate the Z timezone code as a literal as do the 'T'.

Sign in to comment.

Tags

Products


Release

R2018a

1 Answers

Answer by dpb
on 1 May 2019
Edited by dpb
on 1 May 2019
 Accepted Answer

>> tst=GBP_USD.Date(1:10); % just a sample set to play with
>> datetime(tst,'InputFormat','yyyy-MM-dd''T''HH:mm:ss.SSSSSSSSSZ', ...
'TimeZone','Europe/London','Format','yyyyMMddHHmmss')
ans =
10×1 datetime array
20190501095950
20190501095955
20190501100000
20190501100005
20190501100010
20190501100015
20190501100020
20190501100025
20190501100030
20190501100035
>>

  6 Comments

dpb
on 3 May 2019
2) Hmmm, Peter, I thought I had tried that and datetime barfed...have to go back and see if can find that in command history to see if I had a syntax error maybe...
1) I just chose London for lack of anything other info...
Hi Guys...yes the time i in fact use is UTC, but adjusted for UK time I believe.
Then it seems like dpb had the right answer. Reputation heading for 10K!

Sign in to comment.



Translated by