-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path24x1dateTime.py
More file actions
25 lines (21 loc) · 867 Bytes
/
24x1dateTime.py
File metadata and controls
25 lines (21 loc) · 867 Bytes
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
import datetime
from datetime import *
# :::::::: Formatting Date times ::::::::::
"""
%d = shows date || %m = shows month number || %H = hour (24) || %S = second
%b = first 3 letters of Month || %y = last 2 digit of a year || %I = hour (12) || %Z = time zone name (empty of naive)
%B = full month name || %Y = full year || %M = minute || %c = shows complete time
%x = shows date dd/mm/yyyy || %X = shows time hh:mm:ss || %p = AM / PM ||
"""
myDate = datetime.today() # gives you date and time together
myDateShort = date.today() # give only the date
print(myDate)
print(myDateShort)
newDate = myDate.strftime('%c')
print(newDate)
newDate = myDateShort.strftime('%c')
print(newDate)
myBDay = datetime(1987, 2, 5)
print(myBDay.strftime('%d/ %b/ %y'))
rem = myDate - myBDay
print(rem)