mbenam — 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.
Chris — 9-Oct-2022/11:50:57-7:00
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
]
mbenam — 9-Oct-2022/12:17:01-7:00
This is great! Need to learn the keyword "make". Thank you.
Nick — 9-Oct-2022/12:40:20-7:00
x: "230919"
insert at x 1 "20"
insert at x 5 "/"
insert at x 8 "/"
to-date x
mbenam — 9-Oct-2022/13:28:44-7:00
This seems more elegant, Nick. However, on Red had to use load command instead of to-date.