convert dates to specific format
2 views (last 30 days)
Stephen23 on 19 Jul 2022
Edited: Stephen23 on 19 Jul 2022
My guess is that you have unfortunately stored each date as one numeric value, whose digits just happen to coincide with the date units' digits. This is rather a misuse of numerics, and is best fixed by importing that data correctly, rather than trying to "fix" it later. But you can convert to a proper DATETIME object if required:
N = 200701022359 % ugh
D = datetime(string(N),'Format','uuuuMMddHHmm')
Note that you should avoid deprecated functions DATENUM, DATESTR, and DATEVEC.