user310291
user310291

Reputation: 38210

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

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 ?

Upvotes: 3

Views: 59

Answers (1)

DocKimbel
DocKimbel

Reputation: 3199

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

Upvotes: 4

Related Questions