Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
crawler
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chengyang Zhong
crawler
Commits
eec09def
Commit
eec09def
authored
Aug 10, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2a788ff8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
trans_strtime_to_timestamp.py
crawler_sys/utils/trans_strtime_to_timestamp.py
+10
-1
No files found.
crawler_sys/utils/trans_strtime_to_timestamp.py
View file @
eec09def
...
...
@@ -126,7 +126,7 @@ def trans_strtime_to_timestamp(input_time, missing_year=False):
print
(
'error in {input_time}'
.
format
(
input_time
=
input_time
))
return
real_time
#for str_time %Y-%m
if
len
(
input_time
)
==
5
:
if
len
(
input_time
)
==
5
:
year
=
func_inyear
(
input_time
)
if
year
!=
str
(
0
):
input_time
=
year
+
'-'
+
input_time
...
...
@@ -135,6 +135,15 @@ def trans_strtime_to_timestamp(input_time, missing_year=False):
else
:
print
(
'error in {input_time}'
.
format
(
input_time
=
input_time
))
return
real_time
if
len
(
input_time
)
==
11
:
year
=
func_inyear
(
input_time
)
if
year
!=
str
(
0
):
input_time
=
year
+
'-'
real_time
=
int
(
datetime
.
datetime
.
strptime
(
input_time
,
'
%
Y-
%
m-
%
d
%
H:
%
M'
)
.
timestamp
()
*
1e3
)
else
:
print
(
'error in {input_time}'
.
format
(
input_time
=
input_time
))
return
real_time
try
:
return
int
(
datetime
.
datetime
.
strptime
(
input_time
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
*
1e3
)
except
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment