Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date substraction why don't I get hh:mm:ss in Rebol / Red?

Tags:

rebol

red-lang

1°) I get only the number of days, how to also get the hh:mm:ss ?

diff: (now - (10-Nov-2017/15:00:00))

6

2°) What's the most elegant way to get the number of minutes ?

like image 626
user310291 Avatar asked Dec 18 '25 06:12

user310291


1 Answers

1°) I get only the number of days, how to also get the hh:mm:ss ?

Use difference function for that:

>> difference now 10-Nov-2017/15:00:00
== 145:19:24

2°) What's the most elegant way to get the number of minutes ?

The same way as for any other date value:

>> d: difference now 10-Nov-2017/15:00:00
>> d/minute
== 21

Alternatively, you can use pick to avoid setting the intermediary date to a word:

>> pick (difference now 10-Nov-2017/15:00:00) 2  ; Red and Rebol2/3
== 21
>> pick (difference now 10-Nov-2017/15:00:00) 'minute ; Rebol3, not yet implemented in Red
== 21
like image 149
DocKimbel Avatar answered Dec 20 '25 12:12

DocKimbel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!