Re: Date of yesterday

2018-04-10 Thread Stuart Henderson
On 2018-04-09, Paul de Weerd wrote: > On Sun, Apr 08, 2018 at 11:12:43PM -0700, Philip Guenther wrote: >| On Sun, Apr 8, 2018 at 10:54 PM, Robert Klein wrote: >| >| > this works for me: >| > >| > date -r $(( $(date +%s) - 1 * 24 * 60 * 60 )) +%Y_%m_%d >| >

Re: Date of yesterday

2018-04-10 Thread Stephane HUC "PengouinBSD"
this will be my final answer - and which certainly does not want to be a polemic: No, at school I wasn't told about an'leap second', an intercalar second! But, I only went in third - some here will be able to tell you what this level is, personally I don't know the correspondence, with other

Re: Date of yesterday

2018-04-09 Thread Jordan Geoghegan
On 04/09/18 13:58, Stephane HUC "PengouinBSD" wrote: Excuse-me, but i dont really understand this! (perhaps, because it's in english). If you don't understand how Daylight Savings time works, or how time works on computers in general, then you should just trust the expert advice offered to

Re: Date of yesterday

2018-04-09 Thread Daniel Ouellet
On 4/9/18 4:36 PM, Stephane HUC "PengouinBSD" wrote: > what? > > please, explain-me! EDT EST for example. Some days are even 82800 long. Some time zone even have 1/2 hour if these still exists, so the would be 84600 or 88200.

Re: Date of yesterday

2018-04-09 Thread Martin Schröder
2018-04-09 20:58 GMT+02:00 Stephane HUC "PengouinBSD" : > get the current timestamp, subtracting 86400 seconds is not reliable to > get yesterday's date to the nearest second? Did they teach leap seconds in your school yet? Best Martin

Re: Date of yesterday

2018-04-09 Thread Allan Streib
Tom Smyth writes: > Howdy... > Daylight savings time sucks... :/... > Is there a way to Reference UTC and then do the calculating > n and then convert to local time zone if you are worried about > calculating yesterday on the edge case of the 2 hrs a year > that

Re: Date of yesterday

2018-04-09 Thread Daniel Ouellet
Here to confuse you even more, there is time zone that have 30 minutes and even 45 minutes differences. https://www.timeanddate.com/time/time-zones-interesting.html Have fun. On 4/9/18 4:44 PM, Daniel Ouellet wrote: > On 4/9/18 4:36 PM, Stephane HUC "PengouinBSD" wrote: >> what? >> >> please,

Re: Date of yesterday

2018-04-09 Thread Philip Guenther
On Mon, Apr 9, 2018 at 2:05 PM, Tom Smyth wrote: > Howdy... > Daylight savings time sucks... :/... > Is there a way to Reference UTC and then do the calculating > n and then convert to local time zone if you are worried about > calculating yesterday on the edge

Re: Date of yesterday

2018-04-09 Thread Stephane HUC "PengouinBSD"
Excuse-me, but i dont really understand this! (perhaps, because it's in english). Le 04/09/18 à 22:45, Philip Guenther a écrit : > On Mon, Apr 9, 2018 at 1:36 PM, Stephane HUC "PengouinBSD" < > b...@stephane-huc.net> wrote: > >> what? >> >> please, explain-me! >> > As I wrote before, and you

Re: Date of yesterday

2018-04-09 Thread Tom Smyth
Howdy... Daylight savings time sucks... :/... Is there a way to Reference UTC and then do the calculating n and then convert to local time zone if you are worried about calculating yesterday on the edge case of the 2 hrs a year that this would make an impact... as a side issue would avoiding

Re: Date of yesterday

2018-04-09 Thread Philip Guenther
On Mon, Apr 9, 2018 at 1:36 PM, Stephane HUC "PengouinBSD" < b...@stephane-huc.net> wrote: > what? > > please, explain-me! > As I wrote before, and you quoted before: > | Did you test that after 11pm on the day when daylight-saving time ends and > | the clock is turned back, resulting in a 25

Re: Date of yesterday

2018-04-09 Thread Michael Lambert
> On 9 Apr 2018, at 16:34, Philip Guenther wrote: > > On Mon, Apr 9, 2018 at 11:58 AM, Stephane HUC "PengouinBSD" < > b...@stephane-huc.net> wrote: > >> get the current timestamp, subtracting 86400 seconds is not reliable to >> get yesterday's date to the nearest second? >>

Re: Date of yesterday

2018-04-09 Thread Stephane HUC "PengouinBSD"
what? please, explain-me! Le 04/09/18 à 22:34, Philip Guenther a écrit : > On Mon, Apr 9, 2018 at 11:58 AM, Stephane HUC "PengouinBSD" > > wrote: > > get the current timestamp, subtracting 86400 seconds is not > reliable to > get

Re: Date of yesterday

2018-04-09 Thread Philip Guenther
On Mon, Apr 9, 2018 at 11:58 AM, Stephane HUC "PengouinBSD" < b...@stephane-huc.net> wrote: > get the current timestamp, subtracting 86400 seconds is not reliable to > get yesterday's date to the nearest second? > terrible! Yes, some days are 9 seconds long.

Re: Date of yesterday

2018-04-09 Thread Stephane HUC "PengouinBSD"
get the current timestamp, subtracting 86400 seconds is not reliable to get yesterday's date to the nearest second? terrible! Le 04/09/18 à 20:48, Philip Guenther a écrit : > On Mon, Apr 9, 2018 at 2:04 AM, Stephane HUC "CIOTBSD" > wrote: > >> as: date -r $(( $(date +%s)

Re: Date of yesterday

2018-04-09 Thread Philip Guenther
On Mon, Apr 9, 2018 at 2:04 AM, Stephane HUC "CIOTBSD" wrote: > as: date -r $(( $(date +%s) - 86400)) +%F > ;) ... > > On Sun, Apr 08, 2018 at 11:12:43PM -0700, Philip Guenther wrote: > > | Did you test that after 11pm on the day when daylight-saving time ends > and > >

Re: Date of yesterday

2018-04-09 Thread Stephane HUC "CIOTBSD"
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 wrote: > | > | > this works for me: > | > > | > date -r $(( $(date

Re: Date of yesterday

2018-04-09 Thread Christophe Simon
'now -1 day' '+%Y_%m_%d' 2018_04_09 $ /bin/date -d 'yesterday' '+%Y_%m_%d' 2018_04_09 I don't know when it was imported into BSD's date, but this extension is available on OpenBSD, at least in 6.3... There is a -d option, but it does not do what you expect. What date is it now? Try other values

Re: Date of yesterday

2018-04-09 Thread Otto Moerbeek
On Mon, Apr 09, 2018 at 12:50:33PM +0200, Christophe Simon wrote: > The command I executed was run on OpenBSD: > > $ uname -a > OpenBSD XXX 6.3 GENERIC.MP#107 amd64 > > $ /bin/date -d 'now -1 day' '+%Y_%m_%d' > 2018_04_09 > > $ /bin/date -d 'yesterday' '+%Y_%m_%d

Re: Date of yesterday

2018-04-09 Thread Christophe Simon
The command I executed was run on OpenBSD: $ uname -a OpenBSD XXX 6.3 GENERIC.MP#107 amd64 $ /bin/date -d 'now -1 day' '+%Y_%m_%d' 2018_04_09 $ /bin/date -d 'yesterday' '+%Y_%m_%d' 2018_04_09 I don't know when it was imported into BSD's date, but this extension is available on OpenBSD

Re: Date of yesterday

2018-04-09 Thread Otto Moerbeek
Max Power <open...@cpnetserver.net> wrote: > > > > > Hi guys, > > > How can I do to get yesterday's date? > > > I need for create a backup directory. > > > On Linux: > > > yesterday=backup_$(date -d "yesterday" '+%Y_%m_%d') > > > mkdir -p /raid1/backup/$yesterday > > > > > > Thanks for reply. > > > > > > >

Re: Date of yesterday

2018-04-09 Thread Christophe Simon
+0200 Max Power <open...@cpnetserver.net> wrote: Hi guys, How can I do to get yesterday's date? I need for create a backup directory. On Linux: yesterday=backup_$(date -d "yesterday" '+%Y_%m_%d') mkdir -p /raid1/backup/$yesterday Thanks for reply.

Re: Date of yesterday

2018-04-09 Thread Paul de Weerd
On Sun, Apr 08, 2018 at 11:12:43PM -0700, Philip Guenther wrote: | On Sun, Apr 8, 2018 at 10:54 PM, Robert Klein 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

Re: Date of yesterday

2018-04-09 Thread Philip Guenther
On Sun, Apr 8, 2018 at 10:54 PM, Robert Klein 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? I

Re: Date of yesterday

2018-04-09 Thread Robert Klein
ory. > On Linux: > yesterday=backup_$(date -d "yesterday" '+%Y_%m_%d') > mkdir -p /raid1/backup/$yesterday > > Thanks for reply. >

Date of yesterday

2018-04-08 Thread Max Power
Hi guys, How can I do to get yesterday's date? I need for create a backup directory. On Linux: yesterday=backup_$(date -d "yesterday" '+%Y_%m_%d') mkdir -p /raid1/backup/$yesterday Thanks for reply.