12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import time
- import locale
- from datetime import date
- def test_1():
- now = time.time()
- print(now)
-
- print(time.ctime(now))
-
- print(time.localtime())
-
- print(time.gmtime())
-
- print(time.mktime(time.localtime()))
- def test_2():
- now = time.localtime()
- print(now[0])
- print(list(now[x] for x in range(9)))
-
- def test_3():
- fmt = "It's %A, %B, %d, %Y, local time %I:%M:%S%p"
- t = time.localtime()
- print(t)
- print(time.strftime(fmt, t))
- def test_4():
- fmt = "%Y-%m-%d"
- print(time.strptime("2019-01-29", fmt))
-
-
- def test_5():
-
- ru = [name for name in locale.locale_alias.keys() if name.startswith('ru')]
- print(ru)
- day = date(2024, 7, 31)
- print(day)
- print(day.strftime('%A, %B %d'))
- locale.setlocale(locale.LC_TIME, ru[0])
- print(day.strftime('%A, %B %d'))
- print(time.ctime(time.time()))
|