1 | """
|
---|
2 | >>> format(my_birthday, '')
|
---|
3 | ''
|
---|
4 | >>> format(my_birthday, 'a')
|
---|
5 | 'p.m.'
|
---|
6 | >>> format(my_birthday, 'A')
|
---|
7 | 'PM'
|
---|
8 | >>> format(my_birthday, 'j')
|
---|
9 | '7'
|
---|
10 | >>> format(my_birthday, 'l')
|
---|
11 | 'Saturday'
|
---|
12 | >>> format(my_birthday, 'L')
|
---|
13 | 'False'
|
---|
14 | >>> format(my_birthday, 'm')
|
---|
15 | '07'
|
---|
16 | >>> format(my_birthday, 'M')
|
---|
17 | 'Jul'
|
---|
18 | >>> format(my_birthday, 'n')
|
---|
19 | '7'
|
---|
20 | >>> format(my_birthday, 'N')
|
---|
21 | 'July'
|
---|
22 | >>> format(my_birthday, 'O')
|
---|
23 | '+0100'
|
---|
24 | >>> format(my_birthday, 'P')
|
---|
25 | '10 p.m.'
|
---|
26 | >>> format(my_birthday, 'r')
|
---|
27 | 'Sat, 7 Jul 1979 22:00:00 +0100'
|
---|
28 | >>> format(my_birthday, 's')
|
---|
29 | '00'
|
---|
30 | >>> format(my_birthday, 'S')
|
---|
31 | 'th'
|
---|
32 | >>> format(my_birthday, 't')
|
---|
33 | Traceback (most recent call last):
|
---|
34 | ...
|
---|
35 | NotImplementedError
|
---|
36 | >>> format(my_birthday, 'T')
|
---|
37 | 'CET'
|
---|
38 | >>> format(my_birthday, 'U')
|
---|
39 | '300445200'
|
---|
40 | >>> format(my_birthday, 'w')
|
---|
41 | '6'
|
---|
42 | >>> format(my_birthday, 'W')
|
---|
43 | '27'
|
---|
44 | >>> format(my_birthday, 'y')
|
---|
45 | '79'
|
---|
46 | >>> format(my_birthday, 'Y')
|
---|
47 | '1979'
|
---|
48 | >>> format(my_birthday, 'z')
|
---|
49 | '188'
|
---|
50 | >>> format(my_birthday, 'Z')
|
---|
51 | '3600'
|
---|
52 |
|
---|
53 | >>> format(summertime, 'I')
|
---|
54 | '1'
|
---|
55 | >>> format(summertime, 'O')
|
---|
56 | '+0200'
|
---|
57 | >>> format(wintertime, 'I')
|
---|
58 | '0'
|
---|
59 | >>> format(wintertime, 'O')
|
---|
60 | '+0100'
|
---|
61 |
|
---|
62 | >>> format(my_birthday, 'Y z \\C\\E\\T')
|
---|
63 | '1979 188 CET'
|
---|
64 | """
|
---|
65 | from django.utils import dateformat
|
---|
66 | format = dateformat.format
|
---|
67 | import datetime
|
---|
68 |
|
---|
69 | import os
|
---|
70 | import time
|
---|
71 |
|
---|
72 | os.environ['TZ'] = 'Europe/Copenhagen'
|
---|
73 | time.tzset()
|
---|
74 | reload(dateformat)
|
---|
75 |
|
---|
76 | my_birthday = datetime.datetime(1979, 7, 7, 22, 00)
|
---|
77 | summertime = datetime.datetime(2005, 10, 30, 1, 00)
|
---|
78 | wintertime = datetime.datetime(2005, 10, 30, 4, 00)
|
---|