Message Boards Message Boards

GROUPS:

Convert the notation of years from short to long?

Posted 1 year ago
2138 Views
|
3 Replies
|
1 Total Likes
|

I got date lists such as for instance {{16, 1, 4}, {16, 1, 5}, {16, 1, 6}}. How do I convert this list in an easy way to {{2016, 1, 4}, {2016, 1, 5}, {2016, 1, 6}} ?

3 Replies

Hi Laurens,

DateObject can also correctly interpret that format.

DateObject[{16, 1, 4}]

enter image description here

Thank you, Michael. The first method is nice and simple, but the second is really beautiful.

There are several ways or this. Just mentioning two: (1) You can use Map:

Map[{2000, 0, 0} + # &, lst]

(2) You can use Transpose:

({2000, 0, 0} + lst\[Transpose])\[Transpose]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract