String to date

Started by mbenam on 8-Oct-2022/23:30:33-7:00
Hello. Newbie to Rebol/Red. How can I convert "230919" to date that represents 2023/09/19? My plan is to count days in-between today and the date represented by the string. Thanks.
If your string is always "YYMMDD" then you can just copy out the various parts: mystring: "230919" make date! reduce [ 2000 + to integer! copy/part mystring 2 to integer! copy/part skip mystring 2 2 to integer! copy/part skip mystring 4 2 ]
This is great! Need to learn the keyword "make". Thank you.
x: "230919" insert at x 1 "20" insert at x 5 "/" insert at x 8 "/" to-date x
This seems more elegant, Nick. However, on Red had to use load command instead of to-date.

Reply