as: date -r $(( $(date +%s) - 86400)) +%F
;)

Le 04/09/18 à 10:26, Paul de Weerd a écrit :
> On Sun, Apr 08, 2018 at 11:12:43PM -0700, Philip Guenther wrote:
> | On Sun, Apr 8, 2018 at 10:54 PM, Robert Klein <rokl...@roklein.de> wrote:
> | 
> | > this works for me:
> | >
> | > date -r $(( $(date +%s) - 1 * 24 * 60 * 60 )) +%Y_%m_%d
> | >
> | 
> | Did you test that after 11pm on the day when daylight-saving time ends and
> | the clock is turned back, resulting in a 25 hour long day?
> 
> For those special occassions there's:
> 
> date -j `date +%Y%m%d1200` +%s
> 
> Turning this into:
> 
> date -r $(($(date -j `date +%Y%m%d1200` +%s) - 86400)) +%Y_%m_%d
> 
> Less perl (and less typing) at the expense of a total of 3 invocations
> of date.  Although I loathe the natural language parsing options built
> into Linux date(1), this sort of thing is rather convenient.
> 
> | I would use this:
> |    perl -MPOSIX=strftime,mktime -le '@d=localtime(); $d[3]--; mktime(@d);
> | print strftime("%Y_%m_%d",@d)'
> | 
> | Philip Guenther
> 
> Paul 'abolish DST now' de Weerd
> 

-- 
~ " Fully Basic System Distinguish Life! " ~ " Libre as a BSD " +=<<<
----
<me>Stephane HUC as PengouinBSD or CIOTBSD</me>
<mail>b...@stephane-huc.net</mail>

Reply via email to