Filter löschen
Filter löschen

how do i convert my matlab date format, such as '2015-12-31' to a date format 20151231, which is required as the Bloomberg End_Dt?

1 Ansicht (letzte 30 Tage)
I am trying to pull data from Bloomberg, using the following.
d = getdata(c,'SPX Index','INDX_MEMBERS','End_DT', RebalanceDate)
However, it appears that Bloomberg requires the "RebalanceDate' field to be in the format of 'yyyymmdd'. My RebalanceDate is in Matlab format : 2015-12-31, for example.
Does anyone know how I can convert 2015-12-31 to 20151231?
Many thanks for your help.

Akzeptierte Antwort

the cyclist
the cyclist am 27 Aug. 2017
datestr('2015-12-31','yyyymmdd')

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 27 Aug. 2017
If you have the date in the form of a string, then just delete the '-' characters.
If you have it in the form of a datenum, then like the cyclist shows, datestr() it with appropriate format.
If you have it in the form of a datetime, set its Format property to 'yyyyMMdd' and then char() the object to get the string.
  1 Kommentar
Bryan Wang
Bryan Wang am 27 Aug. 2017
thank you very much for the very prompt help. I have spent several hours searching online and trying different ways.
This really helps. Many thanks.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Bloomberg Desktop finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by