Re: format string: time for today, date for others.

2011-01-20 Thread Ed Blackman
On Fri, Jan 07, 2011 at 05:29:32AM -0600, David Champion wrote: Aha, finally I have discovered a use for mutt's % expando. You can optimize this one step further. set index_format="./format_date.sh '%[%Y%m%d]' '%<%Y%m%d>' |" #!/bin/sh if [ $1 -eq $2 ]; then echo "%4C %Z %{ %

Re: format string: time for today, date for others.

2011-01-07 Thread du yang
On Fri, Jan 07, 2011 at 05:07 -0600, David Champion wrote: > * On 07 Jan 2011, Yue Wu wrote: > > On Fri, Jan 07, 2011 at 03:40:12PM +0800, du yang wrote: > > > > > > if [ $(date -d "$(date '+%Y-%m-%d')" "+%s") -gt $epoch ]; then > > > echo "%4C %Z %{%d.%m.%y} %-15.15F (%?l?%4l&%4c?) %?H?[%H]?%

Re: format string: time for today, date for others.

2011-01-07 Thread du yang
On Fri, Jan 07, 2011 at 18:21 +0800, Yue Wu wrote: > On Fri, Jan 07, 2011 at 03:40:12PM +0800, du yang wrote: > > Hi, > > > > I improved the script to fulfill the author's the expectation(just display > > time for today's mails), > > only 'if condition' changed. > > > > - du yang > > > > ==

Re: format string: time for today, date for others.

2011-01-07 Thread du yang
On Fri, Jan 07, 2011 at 05:29 -0600, David Champion wrote: > * On 07 Jan 2011, du yang wrote: > > Hi, > > > > I improved the script to fulfill the author's the expectation(just display > > time for today's mails), > > only 'if condition' changed. > > ... > > if [ $(date -d "$(date '+%Y-%m-%d')"

Re: format string: time for today, date for others.

2011-01-07 Thread David Champion
* On 07 Jan 2011, du yang wrote: > Hi, > > I improved the script to fulfill the author's the expectation(just display > time for today's mails), > only 'if condition' changed. > ... > if [ $(date -d "$(date '+%Y-%m-%d')" "+%s") -gt $epoch ]; then > echo "%4C %Z %{%d.%m.%y} %-15.15F (%?l?%4l

Re: format string: time for today, date for others.

2011-01-07 Thread Yue Wu
On Fri, Jan 07, 2011 at 05:07:47AM -0600, David Champion wrote: > * On 07 Jan 2011, Yue Wu wrote: > > On Fri, Jan 07, 2011 at 03:40:12PM +0800, du yang wrote: > > > > > > if [ $(date -d "$(date '+%Y-%m-%d')" "+%s") -gt $epoch ]; then > > > echo "%4C %Z %{%d.%m.%y} %-15.15F (%?l?%4l&%4c?) %?H?[

Re: format string: time for today, date for others.

2011-01-07 Thread du yang
On Fri, Jan 07, 2011 at 18:54 +0800, Yue Wu wrote: > On Fri, Jan 07, 2011 at 06:32:44PM +0800, du yang wrote: > > > > Change '#!/bin/bash' to '#!/bin/sh' in the script header, then it may work. > > > > else please post the error details. > > > > I've tried it, but many messages like: > > u

Re: format string: time for today, date for others.

2011-01-07 Thread David Champion
* On 07 Jan 2011, Yue Wu wrote: > On Fri, Jan 07, 2011 at 03:40:12PM +0800, du yang wrote: > > > > if [ $(date -d "$(date '+%Y-%m-%d')" "+%s") -gt $epoch ]; then > > echo "%4C %Z %{%d.%m.%y} %-15.15F (%?l?%4l&%4c?) %?H?[%H]?%s%" > > else > > echo "%4C %Z %{ %H:%M} %-15.15F (%?l?%4l&%4c?

Re: format string: time for today, date for others.

2011-01-07 Thread Yue Wu
On Fri, Jan 07, 2011 at 06:32:44PM +0800, du yang wrote: > > Change '#!/bin/bash' to '#!/bin/sh' in the script header, then it may work. > > else please post the error details. > I've tried it, but many messages like: usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdH

Re: format string: time for today, date for others.

2011-01-07 Thread du yang
On Fri, Jan 07, 2011 at 18:21 +0800, Yue Wu wrote: > On Fri, Jan 07, 2011 at 03:40:12PM +0800, du yang wrote: > > Hi, > > > > I improved the script to fulfill the author's the expectation(just display > > time for today's mails), > > only 'if condition' changed. > > > > - du yang > > > > ==

Re: format string: time for today, date for others.

2011-01-07 Thread Yue Wu
On Fri, Jan 07, 2011 at 03:40:12PM +0800, du yang wrote: > Hi, > > I improved the script to fulfill the author's the expectation(just display > time for today's mails), > only 'if condition' changed. > > - du yang > > > #!/bin/bash > > epoch="$1" > > if [ $(date -

Re: format string: time for today, date for others.

2011-01-07 Thread Yue Wu
On Wed, Jan 05, 2011 at 04:32:44PM -0600, David Champion wrote: > * On 05 Jan 2011, Yue Wu wrote: > > Hi list, > > > > Is there a date/time string that show the time only for today's emails > > but date for else? So, in the index, the emails that got today will > > show the time only, but the one

Re: format string: time for today, date for others.

2011-01-06 Thread du yang
Hi, I improved the script to fulfill the author's the expectation(just display time for today's mails), only 'if condition' changed. - du yang #!/bin/bash epoch="$1" if [ $(date -d "$(date '+%Y-%m-%d')" "+%s") -gt $epoch ]; then echo "%4C %Z %{%d.%m.%y} %-15.

Re: format string: time for today, date for others.

2011-01-06 Thread Toby Cubitt
On Thu, Jan 06, 2011 at 03:09:53AM +, Toby Cubitt wrote: > As far as I recall (it's a long time since I looked at it), the > date_conditional patch straightforwardly compares the email date stamp > against the current time. The <1d conditional is true whenever the email > is dated less than 24h

Re: format string: time for today, date for others.

2011-01-06 Thread David Champion
* On 05 Jan 2011, Toby Cubitt wrote: > > is dated less than 24h before the current time. That's *not* what I'm > after. When the current time is 00:01 on the 6 Jan, I want an email that > arrived at 23:59 on the 5 Jan to display "Sun 05", even though the email > is only two minutes old. I unders

Re: format string: time for today, date for others.

2011-01-05 Thread Toby Cubitt
On Wed, Jan 05, 2011 at 07:22:18PM -0600, David Champion wrote: > * On 05 Jan 2011, Toby Cubitt wrote: > > > > Yes, but how would you use this to e.g. print only the time for all > > emails received today, but print the date for all emails received > > yesterday or earlier? A split point of 24h i

Re: format string: time for today, date for others.

2011-01-05 Thread David Champion
* On 05 Jan 2011, Toby Cubitt wrote: > > Yes, but how would you use this to e.g. print only the time for all > emails received today, but print the date for all emails received > yesterday or earlier? A split point of 24h is no use. If it's currently That's what nested_if is for. Here is the da

Re: format string: time for today, date for others.

2011-01-05 Thread Toby Cubitt
On Wed, Jan 05, 2011 at 05:20:19PM -0600, David Champion wrote: > * On 05 Jan 2011, Toby Cubitt wrote: > > > > If I remember correctly, the date_conditional patch doesn't *quite* > > let you have a different date/time string for today, rather it gives > > you a different date/time string for the

Re: format string: time for today, date for others.

2011-01-05 Thread Andreas Kneib
Hi, * Yue Wu schrieb am Donnerstag, den 06. Januar 2011: > Is there a date/time string that show the time only for today's emails > but date for else? So, in the index, the emails that got today will > show the time only, but the ones that got on other days will show the > date and time. I use t

Re: format string: time for today, date for others.

2011-01-05 Thread David Champion
* On 05 Jan 2011, Toby Cubitt wrote: > > If I remember correctly, the date_conditional patch doesn't *quite* let > you have a different date/time string for today, rather it gives you a > different date/time string for the last 24h. The best documentation I've seen is the changelog entry that I

Re: format string: time for today, date for others.

2011-01-05 Thread Toby Cubitt
On Wed, Jan 05, 2011 at 04:32:44PM -0600, David Champion wrote: > * On 05 Jan 2011, Yue Wu wrote: > > Hi list, > > > > Is there a date/time string that show the time only for today's emails > > but date for else? So, in the index, the emails that got today will > > show the time only, but the one

Re: format string: time for today, date for others.

2011-01-05 Thread David Champion
* On 05 Jan 2011, Yue Wu wrote: > Hi list, > > Is there a date/time string that show the time only for today's emails > but date for else? So, in the index, the emails that got today will > show the time only, but the ones that got on other days will show the > date and time. Not in out-of-box m

format string: time for today, date for others.

2011-01-05 Thread Yue Wu
Hi list, Is there a date/time string that show the time only for today's emails but date for else? So, in the index, the emails that got today will show the time only, but the ones that got on other days will show the date and time. -- Regards, Yue Wu Key Laboratory of Modern Chinese Medicines