rebol之日期减法为什么我得不到hh :mm:ss in Rebol/Red
kuangbin
阅读:77
2025-01-19 22:14:33
评论:0
1°) 我只得到天数,如何同时得到 hh:mm:ss ?
diff: (now - (10-Nov-2017/15:00:00))
6
2°) 获取分钟数最优雅的方法是什么?
请您参考如下方法:
1°) I get only the number of days, how to also get the hh:mm:ss ?
为此使用difference
函数:
>> difference now 10-Nov-2017/15:00:00
== 145:19:24
2°) What's the most elegant way to get the number of minutes ?
与任何其他日期值相同的方式:
>> d: difference now 10-Nov-2017/15:00:00
>> d/minute
== 21
或者,您可以使用 pick
来避免将中间日期设置为单词:
>> 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
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。