-
Notifications
You must be signed in to change notification settings - Fork 0
/
date
43 lines (30 loc) · 746 Bytes
/
date
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# print the name of the weekday
date '+%a' #short version
date '+%A' #long version
# unix timestamp
date -u '+%s'
# see time in different timezone
TZ='Asia/Qatar' date
# print date in a simple format
date "+%b %d (%a)"
# print time alone
date "+%I:%M%p"
# print a usable filename with date and time
date '+%4Y%m%d_%s' or date '+%4Y%m%d_%H%M%S'
# print todays date
date '+%Y-%m-%d'
# last date of month
date -d "-$(date +%d) days month" +%Y-%m-%d
# first three characters of month name
date '+%b'
# date as number without separators
date +%Y%m%d
# date arithmetic
# Get the date n number of days into the future
date --date '+10 days'
# 2023_08_03
date "+%Y_%m_%d"
# Saturday, Nov 11
date "+%A, %b %d"
# for 24 h time
date '+%H:%M'