emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Get the maximum date within a list of dates
@ 2013-12-22  6:29 Truong Ha
  2013-12-22  7:00 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Truong Ha @ 2013-12-22  6:29 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

Hi,
How can I get the maximum date within rows of dates in the table?
|    Amount | Date             |+-----------+------------------+|       158 | <2013-12-01 Sun> ||       148 | <2013-12-02 Mon> ||       105 | <2013-12-03 Tue> ||       421 | <2013-12-08 Sun> ||        40 | <2013-12-10 Tue> ||       125 | <2013-12-11 Wed> ||        50 | <2013-12-12 Thu> ||        83 | <2013-12-13 Fri> ||       116 | <2013-12-14 Sat> ||        55 | <2013-12-15 Sun> ||        90 | <2013-12-16 Mon> ||       187 | <2013-12-17 Tue> ||        96 | <2013-12-18 Wed> ||        86 | <2013-12-19 Thu> ||        90 | <2013-12-20 Fri> ||       135 | <2013-12-21 Sat> ||        23 | <2013-12-22 Sun> |
Thanks,Ha 		 	   		  

[-- Attachment #2: Type: text/html, Size: 1654 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Get the maximum date within a list of dates
  2013-12-22  6:29 Get the maximum date within a list of dates Truong Ha
@ 2013-12-22  7:00 ` Bastien
  2013-12-22  7:27   ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2013-12-22  7:00 UTC (permalink / raw)
  To: Truong Ha; +Cc: emacs-orgmode@gnu.org

Hi Truong,

Truong Ha <truonghatsts@outlook.com> writes:

> How can I get the maximum date within rows of dates in the table?
>
> |    Amount | Date             |
> +-----------+------------------+
> |       158 | <2013-12-01 Sun> |
> |       148 | <2013-12-02 Mon> |
> |       105 | <2013-12-03 Tue> |
> |       421 | <2013-12-08 Sun> |
> |        40 | <2013-12-10 Tue> |
> |       125 | <2013-12-11 Wed> |
> |        50 | <2013-12-12 Thu> |
> |        83 | <2013-12-13 Fri> |
> |       116 | <2013-12-14 Sat> |
> |        55 | <2013-12-15 Sun> |
> |        90 | <2013-12-16 Mon> |
> |       187 | <2013-12-17 Tue> |
> |        96 | <2013-12-18 Wed> |
> |        86 | <2013-12-19 Thu> |
> |        90 | <2013-12-20 Fri> |
> |       135 | <2013-12-21 Sat> |
> |        23 | <2013-12-22 Sun> |

Put your cursor in @2$2 then C-c ^ T to sort by "reversed" date
(oldest last).

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Get the maximum date within a list of dates
  2013-12-22  7:00 ` Bastien
@ 2013-12-22  7:27   ` Bastien
  2013-12-22  9:31     ` Ha Truong
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2013-12-22  7:27 UTC (permalink / raw)
  To: Truong Ha; +Cc: emacs-orgmode@gnu.org

Bastien <bzg@gnu.org> writes:

> Put your cursor in @2$2 then C-c ^ T to sort by "reversed" date
> (oldest last).

Also remember you can use ELisp in formulas:

| Date 1                  | Date 2                  | Duration |
|-------------------------+-------------------------+----------|
| [2013-12-21 sam. 00:00] | [2013-12-22 dim. 00:00] |  86400.0 |
#+TBLFM: $3='(- (org-time-string-to-seconds "$2") (org-time-string-to-seconds "$1"));L

PS: note the quotes around "$2" and "$1", they are necessary so
that the date is not literally inserted in the formulas when Org
is computing it.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Get the maximum date within a list of dates
  2013-12-22  7:27   ` Bastien
@ 2013-12-22  9:31     ` Ha Truong
  0 siblings, 0 replies; 4+ messages in thread
From: Ha Truong @ 2013-12-22  9:31 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

Thanks Bastien, it's what I am expecting :)

> From: bzg@gnu.org
> To: truonghatsts@outlook.com
> CC: emacs-orgmode@gnu.org
> Subject: Re: Get the maximum date within a list of dates
> Date: Sun, 22 Dec 2013 08:27:08 +0100
> 
> Bastien <bzg@gnu.org> writes:
> 
> > Put your cursor in @2$2 then C-c ^ T to sort by "reversed" date
> > (oldest last).
> 
> Also remember you can use ELisp in formulas:
> 
> | Date 1                  | Date 2                  | Duration |
> |-------------------------+-------------------------+----------|
> | [2013-12-21 sam. 00:00] | [2013-12-22 dim. 00:00] |  86400.0 |
> #+TBLFM: $3='(- (org-time-string-to-seconds "$2") (org-time-string-to-seconds "$1"));L
> 
> PS: note the quotes around "$2" and "$1", they are necessary so
> that the date is not literally inserted in the formulas when Org
> is computing it.
> 
> HTH,
> 
> -- 
>  Bastien
 		 	   		  

[-- Attachment #2: Type: text/html, Size: 1290 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-22  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-22  6:29 Get the maximum date within a list of dates Truong Ha
2013-12-22  7:00 ` Bastien
2013-12-22  7:27   ` Bastien
2013-12-22  9:31     ` Ha Truong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).