File tree Expand file tree Collapse file tree 1 file changed +21
-21
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +21
-21
lines changed
Original file line number Diff line number Diff line change @@ -51,28 +51,28 @@ def DateTime_or_None(s):
51
51
try :
52
52
if len (s ) < 11 :
53
53
return Date_or_None (s )
54
+
55
+ micros = s [20 :]
56
+
57
+ if len (micros ) == 0 :
58
+ # 12:00:00
59
+ micros = 0
60
+ elif len (micros ) < 7 :
61
+ # 12:00:00.123456
62
+ micros = int (micros ) * 10 ** (6 - len (micros ))
54
63
else :
55
- micros = s [20 :]
56
-
57
- if len (micros ) == 0 :
58
- # 12:00:00
59
- micros = 0
60
- elif len (micros ) < 7 :
61
- # 12:00:00.123456
62
- micros = int (micros ) * 10 ** (6 - len (micros ))
63
- else :
64
- # 12:00:00.123456789
65
- micros = int (micros )
66
-
67
- return datetime (
68
- int (s [:4 ]), # year
69
- int (s [5 :7 ]), # month
70
- int (s [8 :10 ]), # day
71
- int (s [11 :13 ] or 0 ), # hour
72
- int (s [14 :16 ] or 0 ), # minute
73
- int (s [17 :19 ] or 0 ), # second
74
- micros , # microsecond
75
- )
64
+ # 12:00:00.123456789
65
+ micros = int (micros )
66
+
67
+ return datetime (
68
+ int (s [:4 ]), # year
69
+ int (s [5 :7 ]), # month
70
+ int (s [8 :10 ]), # day
71
+ int (s [11 :13 ] or 0 ), # hour
72
+ int (s [14 :16 ] or 0 ), # minute
73
+ int (s [17 :19 ] or 0 ), # second
74
+ micros , # microsecond
75
+ )
76
76
except ValueError :
77
77
return None
78
78
You can’t perform that action at this time.
0 commit comments