fields.DateTime - load/dump to timestamp
See original GitHub issueI’m currently using this code to parse/dump timestamp, but I believe this should be in standard library. Should I create pull request, or have I missed another way to work with datetime/timestamp format?
class DateTime(ma.fields.DateTime):
"""
Class extends marshmallow standart DateTime with "timestamp" format.
"""
DATEFORMAT_SERIALIZATION_FUNCS = \
ma.fields.DateTime.DATEFORMAT_SERIALIZATION_FUNCS.copy()
DATEFORMAT_DESERIALIZATION_FUNCS = \
ma.fields.DateTime.DATEFORMAT_DESERIALIZATION_FUNCS.copy()
DATEFORMAT_SERIALIZATION_FUNCS['timestamp'] = lambda x: x.timestamp()
DATEFORMAT_DESERIALIZATION_FUNCS['timestamp'] = datetime.fromtimestamp
Issue Analytics
- State:
- Created 6 years ago
- Reactions:17
- Comments:20 (11 by maintainers)
Top Results From Across the Web
Convert date and time fields to timestamp - Stack Overflow
I am working with a SQL Server table that shows date modified and time modified in two separate columns. I need to combine...
Read more >Changing the field date type from 'datetime' to 'unix timestamp ...
I am investigating how could I convert the date format in the 4 database tables: field_data_field_article_publication_date from the actual ...
Read more >11.2.2 The DATE, DATETIME, and TIMESTAMP Types
MySQL recognizes DATE , DATETIME , and TIMESTAMP values in several formats, ... A DATETIME or TIMESTAMP value can include a trailing fractional...
Read more >Data.DB.TSQLTimeStampField - Embarcadero DocWiki
TSQLTimeStampField represents a date-time field in a DBExpress dataset. TSQLTimeStampField encapsulates the fundamental behavior common to Date-time fields.
Read more >MySQL Date Format And Timestamp Functions With Examples
MySQL Date And Time Functions · Convert a stored date to a required format while querying the data. · Manipulating existing date time...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Bump, this would be nice to have 👍
Bump, would love to have this