You are not logged in.

#1 2017-07-26 10:51:10

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

date and time

# with some figlet
figlet -f smscript $(date +"%H : %M - %d. %^b. %y")
 , __        ____ ,           _  ___                         ,____
/|(__)   o    __//|          / )|__      /|(|   | \_|)      /|   /
 |/  \          \ |   ----    /    \    | | |   |   |        |  / 
 |\__/   o   \__/ |          /__\__/o    \|/ \_/\_/(\__/o    | /  
                                         (| 

# military time
# day hour minute location month year 
echo $(date +%d%H%MJ%^b%y) 
# J supposedly means local time, ^ is bash for uppercase
# 251259JJUL17

# military time with some spaces
echo $(date +"%d%H%MJ %^b %y")
# 251307J JUL 17

# my 'invention'
# bronto-military time, always local, 
# no spaces, clock first
# hour minute month day year
echo "$(date +%H%M%^b%d%y)"
# 1337JUL2517

p.s. I imagine military time is Z (zulu) time in real usage, that is GMT(0).

I was looking for a format to use in scripts that will show in logs ...

Last edited by brontosaurusrex (2017-07-26 11:02:37)

Offline

#2 2017-08-25 04:27:02

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

Yup 'Zulu' it is.  smile

Close, no : is used in Military Time, well for NATO anyway:  0324J = "3:24 am" local time and there are time zones for Military Time as well. So for me I can use: 0324J if I'm here or 0324P, Zero Three Two Four Papa, if I'm in a different time zone but referring to UTC-3 (Buenos Aires)

Been a LONG time since I've thought of Military Time - although I like and use 24HR time all the time in my conkys: ${time %T} - I suppose ${time %H%M}J would look cool as well.

Yea yea, I see - it's a month old but I just saw it.  big_smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3 2017-08-25 22:01:31

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 417
Website

Re: date and time

brontosaurusrex wrote:
# my 'invention'
...
echo "$(date +%H%M%^b%d%y)"
# 1337JUL2517

I see what you did there.

Offline

#4 2017-08-26 08:30:43

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: date and time

What if I claim that it was actually that leet time of day?
The above is missing an example for use in alphanumeric (file) sorting, maybe: 2 digit year, 2 digit month, 2digit day, 24htime, like

echo $(date +%y%m%d-%H%M)
# 170826-1141

Last edited by brontosaurusrex (2017-08-26 09:41:40)

Offline

#5 2017-08-26 11:07:30

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

wink You can call it whatever you like.

echo "$(date +%H%M%^b%d%y)"
# 1337JUL2517

My apologies.

l33t sounds good though, or brontotime.

Numerical 2 digit time is a can of worms I was told to use DDMMYYYY or for work YYYYMMDD, in the US they use MMDDYY

so what is: 10-11-12?
10 Nov (xx)12, or
Oct 11 (xx)12, or
(xx)10-Nov-12

SAY how about:

echo $(date +%Y%j)

big_smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#6 2017-08-26 11:16:38

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: date and time

Yes, but 'YYMMDD-HHMM_something' filenames will sort correctly in thunar/cli without much thinkering, they are pain to read by human thought.

Example, Jekyll is using date part

ls | tail
2017-08-17-gnome-mpv-youtube-playlist-with-loudnorm-filter.md
2017-08-21-emptybox.md
2017-08-21-firefox-copy-code-extension.md
2017-08-21-solus-3-budgie.md
2017-08-22-asciinema.md
2017-08-22-super-resolution-neural-net.md
2017-08-23-pandoc-toc.md
2017-08-23-per-app-theme.md
2017-08-23-tint2-show-updates.md
2017-08-24-ascii-square.md

Last edited by brontosaurusrex (2017-08-26 11:20:42)

Offline

#7 2017-08-26 11:28:23

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

Ahhhhhhh I see, my scrot outputs:

/media/5/images/2017-08-24_21:27:35_Scrot11.jpg
/media/5/images/2017-08-25_10:23:19_Scrot11.jpg
/media/5/images/2017-08-25_11:43:47_Scrot11.jpg
/media/5/images/2017-08-25_18:06:05_Scrot11.jpg
/media/5/images/2017-08-25_20:32:19_Scrot11.jpg
scrot '%F_%T_Scrot11.jpg' -e 'mv $f /media/5/images/ ; mirage /media/5/images/$f'

S11 = Scrot11 - I couldn't help myself, had to do it.   lol

%F@%T would look l33t as well.

Edit:  No, not quite the same, the _ looks cleaner than @

/media/5/images/2017-08-26_08:32:10_Scrot11.jpg
/media/5/images/2017-08-26@08:34:07_Scrot11.jpg

2017-08-26083407_Scrot11.th.jpg

Last edited by Sector11 (2017-08-26 11:45:48)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#8 2017-09-01 20:51:03

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: date and time

And something completely useless, epoch date in decimal or hexadecimal or base36 (it should 'ls' alphabetically)
https://raw.githubusercontent.com/bront … n/stardate

Last edited by brontosaurusrex (2017-09-01 22:19:00)

Offline

#9 2017-09-01 21:32:09

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 417
Website

Re: date and time

That is not a stardate! smile

Last edited by o9000 (2017-09-01 21:32:29)

Offline

#10 2017-09-01 21:33:12

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

HEY!  That's awesome ... a stardate   big_smile

Well done!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#11 2017-09-01 21:41:30

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: date and time

Actually it seems like ascii base36 notation would/could be useful due to being short

yymmddHHMMSS
170901233948 < dec
27CA81E11C < hex
26IE6K2K < 36

p.s. And I only stole the name of 'stardate' (hard to find something better really).

Last edited by brontosaurusrex (2017-09-01 21:53:08)

Offline

#12 2017-09-01 21:57:22

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

o9000 wrote:

That is not a stardate! smile

That's right.  Star dates were started the second "I" was born.

And I'm not telling tongue   O:)

Besides, as I see it, bronto is just trying to find a neat way to have file names always be correctly listed.

1.png
10.png
11.png
{snip}
19.png
2.png
20.png
21.{snip}

just isn't ... while

1.png
2.png
{snip}
9.png
10.png
11.png
{snip}
19.png
20.png
21.{snip}

would be.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#13 2017-09-01 22:00:40

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

brontosaurusrex wrote:

Actually it seems like ascii base36 notation would/could be useful due to being short

yymmddHHMMSS
170901233948 < dec
27CA81E11C < hex
26IE6K2K < 36

p.s. And I only stole the name of 'stardate' (hard to find something better really).

I still think: brontotime is  cool

Looks like you might be onto something.

How much would it change if you used the full YYYY ?

ie: 20170901233948 < dec


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#14 2017-09-01 22:13:45

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: date and time

That would be

20170902001159
12586772D607
75EDU95HJ

But I see the point, perhaps better to use epoch date then (shortest), that will represent dates back to 1971

1504304073
59A9DBC9
OVMGG9 < winner

Only the back conversion is then a bit convoluted: base36 > epoch > somethingHumanReadable

Last edited by brontosaurusrex (2017-09-02 08:12:57)

Offline

#15 2017-09-01 22:21:53

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

Actually, I'm not thinking "shortest" I'm thinking of keeping them in proper sequence.

but you would need a quite a few to test them  - maybe run your script through faketime.

Description: report faked system time to programs
The Fake Time Preload Library (FTPL, a.k.a. libfaketime) intercepts various system calls which programs use to retrieve the current date and time. It can then report faked dates and times (as specified by you, the user) to these programs. This means you can modify the system time a program sees without having to change the time system-wide. FTPL allows you to specify both absolute dates (e.g., 2004-01-01) and relative dates (e.g., 10 days ago).

Homepage: http://www.code-wizards.com/projects/libfaketime/

I use it to test calendar conkys.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#16 2017-09-01 22:24:55

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: date and time

Not sure what to test?

Offline

#17 2017-09-02 00:36:50

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: date and time

Run your script half a dozen times with the minutes increasing and then the hours so you can get a good feel for the output and see if they still sort 'properly'.

Just a thought.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#18 2017-09-02 08:29:38

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: date and time

Yeah, good idea actually, I did some nasty bugs in the past.

To expand this further to shortness;
- one could define it's own epoch point (date starting at 2000 perhaps, or from this tuesday.. )
- or represent epoch with a number (0=0, 1=1000, 2=2000)
- use base62; 10 numbers + 26 lowercase alphabet + 26 uppercase alphabet

After some tests, some observations (in seconds)
- base36 (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ) biggest 6 numerals are ZZZZZZ which (if base is unix-epoch) will represent year 2038.
- base62 (0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ < this should sort correctly in your file manager/cli) biggest 6 numerals are also ZZZZZZ which (if base is unix-epoch) will represent year 3769. < So if your epoch point is unix, this might be worth using.

p.s. Updated the script to do base62 as well (Kinda disappointed that there are also 6 numerals needed to represent current unix-epoch date).

if epoch point is unix

1504347991 < dec
59AA8757 < hex
OVNEC7 < base36
1Ou5OD < base62

If epoch point is big-bang

441796964000000000 < seconds since big-bang (14 billion years)
62193FF7E10E800 < hex
3CU3YBDU0QGW < 36
lOiYetMHJs < 62
# unless my math is wrong, very likely.

Last edited by brontosaurusrex (2017-09-02 10:42:36)

Offline

Board footer

Powered by FluxBB