-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
426af7e
commit 48e22cc
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Created by Martin Strohalm, Thermo Fisher Scientific | ||
|
||
# import modules | ||
from datetime import datetime | ||
from .converter import register, ValueConverter | ||
|
||
|
||
@register("1BDE1686-0CF2-4921-832B-B1EEFF4EB779") | ||
class DateTime(ValueConverter): | ||
""" | ||
The pyeds.DateTime is used to convert datetime string with format | ||
%m/%d/%Y %H:%M:%S into datetime object. | ||
""" | ||
|
||
|
||
def Convert(self, value): | ||
""" | ||
Converts string to datetime. | ||
Args: | ||
value: str | ||
String data as stored in result file. | ||
Returns: | ||
datetime or None | ||
Parsed datetime. | ||
""" | ||
|
||
# check value | ||
if not value: | ||
return None | ||
|
||
return datetime.strptime(value, '%m/%d/%Y %H:%M:%S') |