I feel like something very basic is missing me,
$dateformat = {"Year", "Month", "Day", "Hour"};
date = DateString[$dateformat]
DateString["Date"]
"2015051215" "Tuesday 12 May 2015"
How to get what DateString["Date"]
gives using $dateformat
and date
?
According to the last example in documentation I thought this should work:
DateString[{date, $dateformat},"Date"]
DateString::str: String 2015051215 cannot be interpreted as a date in format {Year,Month,Day,Hour}. >>
but it isn't..
DateList[{"1505", {"YearShort", "Month"}}]
. However, you need a character like "/" between the YearShort and Month. $\endgroup$DateString[{StringInsert[date, "/", {3, 5, 7}], $dateformat}, "Date"]
does not look nice. $\endgroup$DateList[{"1505", {"YearShort"}}]
I think YearShort automatically switches to Year if it finds more than two numeric characters in a row. So then it's complaining that it doesn't find a Month. $\endgroup$