suppose I have lots of YYYYDDD
date Integers which look like(for example):
dateslalala =
Outer[1000 #1 + #2 &, {2003, 2005, 2004},
RandomInteger[{0, 365}, 20]] // Flatten
gives:
{2003067, 2003280, 2003362, 2003021, 2003223, 2003115, 2003049,
2003233, 2003341, 2003074, 2003134, 2003182, 2003332, 2003061,
2003184,...}
I want to transform them to the style YYYYMMDD like "20010101" or integer 20010101, Err... I didn't figure out have to do this by function like DateString quickly. In fact I use this ugly cumbersome code:
StringJoin /@ ({ToString@#1, StringTake["00" <> ToString@#2, -2],
StringTake[
"00" <> ToString@#3, -2]} & @@@ ((y = Floor[#/1000.];
d = Mod[#, 1000]; DateList[{y, 1, d}][[1 ;; 3]]) & /@
dateslalala))
gives:
{"20030308", "20031007", "20031228", "20030121", "20030811",
"20030425", "20030218", "20030821", "20031207", "20030315", "20030514"...}
is there any more natural way to do this?