计算组织模式表中的时间范围 [英] Calculate time range in org-mode table
问题描述
给定一列具有时间范围的表,例如:
< 2015年10月2日和GT; - < 2015年10月24日> |
| < 2015年10月5日> - < 2015年10月20日> |
....
如何创建显示组织评估结果的列 - 时间范围?
如果我尝试像:
#+ TBLFM:$ 2 ='(org-evaluate-time-range $ 1)
第二列填充
插入时差
在每一行。
这也是很好的生成来自两个不同列的相同结果,例如开始日期
和结束日期
而不是创建一列时间范围那两个。
如果您的日期范围分为2列,一个简单的减法工作并返回天数:
| < 2015年10月5日> | < 2015年10月20日> | 15 |
| < 2013-10-02 08:30> | < 2015年10月24日> | 751.64583 |
#+ TBLFM:$ 3 = $ 2- $ 1
使用 org -evaluate-time-range
也是可以的,你会得到一个很好的格式化输出:
< 2015年10月2日和GT; - < 2015年10月24日> | 22天|
| < 2015年10月5日> - < 2015年10月20日> | 15天|
| < 2015-10-22 Thu 21:08> - < 2015-08-01> | 82天21小时8分钟|
#+ TBLFM:$ 2 ='(组织评估时间范围)
注意 org-evaluate-time-range
接受的唯一可选参数是一个标志,表示将结果插入到当前缓冲区中,不需要。 p>
现在,这个函数(没有参数)如何获得正确的时间范围,当评估是一个完整的奥秘给我;纯魔法(!)
Given a table that has a column of time ranges e.g.:
| <2015-10-02>--<2015-10-24> |
| <2015-10-05>--<2015-10-20> |
....
how can I create a column showing the results of org-evalute-time-range?
If I attempt something like: #+TBLFM: $2='(org-evaluate-time-range $1)
the 2nd column is populated with
Time difference inserted
in every row.
It would also be nice to generate the same result from two different columns with, say, start date
and end date
instead of creating one column of time ranges out of those two.
If you have your date range split into 2 columns, a simple subtraction works and returns number of days:
| <2015-10-05> | <2015-10-20> | 15 |
| <2013-10-02 08:30> | <2015-10-24> | 751.64583 |
#+TBLFM: $3=$2-$1
Using org-evaluate-time-range
is also possible, and you get a nice formatted output:
| <2015-10-02>--<2015-10-24> | 22 days |
| <2015-10-05>--<2015-10-20> | 15 days |
| <2015-10-22 Thu 21:08>--<2015-08-01> | 82 days 21 hours 8 minutes |
#+TBLFM: $2='(org-evaluate-time-range)
Note that the only optional argument that org-evaluate-time-range
accepts is a flag to indicate insertion of the result in the current buffer, which you don't want.
Now, how does this function (without arguments) get the correct time range when evaluated is a complete mystery to me; pure magic(!)
这篇关于计算组织模式表中的时间范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!