Skip to main content
added 98 characters in body
Source Link
E. Chan-López
  • 31.1k
  • 3
  • 29
  • 50

Using DateString and StringSplit:

dstr = DateString[ToString@19001231, "ISODate"]

"1900-12-31"

ToExpression@StringSplit[dstr, Except[DigitCharacter]]

{1900, 12, 31}

The shortest form (Thanks to @eldo!):

StringSplit[DateString[19001231, "ISODate"], "-"]

Using DateString and StringSplit:

dstr = DateString[ToString@19001231, "ISODate"]

"1900-12-31"

ToExpression@StringSplit[dstr, Except[DigitCharacter]]

{1900, 12, 31}

Using DateString and StringSplit:

dstr = DateString[ToString@19001231, "ISODate"]

"1900-12-31"

ToExpression@StringSplit[dstr, Except[DigitCharacter]]

{1900, 12, 31}

The shortest form (Thanks to @eldo!):

StringSplit[DateString[19001231, "ISODate"], "-"]
Source Link
E. Chan-López
  • 31.1k
  • 3
  • 29
  • 50

Using DateString and StringSplit:

dstr = DateString[ToString@19001231, "ISODate"]

"1900-12-31"

ToExpression@StringSplit[dstr, Except[DigitCharacter]]

{1900, 12, 31}