date and time format change

1 Ansicht (letzte 30 Tage)
Charles
Charles am 1 Mai 2019
Kommentiert: Peter Perkins am 9 Mai 2019
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 Kommentare
Charles
Charles am 1 Mai 2019
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
dpb am 1 Mai 2019
What is the time zone???
You don't separate the Z timezone code as a literal as do the 'T'.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

dpb
dpb am 1 Mai 2019
Bearbeitet: dpb am 1 Mai 2019
>> 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 Kommentare
Charles
Charles am 4 Mai 2019
Hi Guys...yes the time i in fact use is UTC, but adjusted for UK time I believe.
Peter Perkins
Peter Perkins am 9 Mai 2019
Then it seems like dpb had the right answer. Reputation heading for 10K!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Timetables finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by