I want to apply a custom DateTime format for the data retrieved from model using the Schema in flask marshmallow.
Currently using the schema like:
class ScheduleListSchema(ma.Schema):
class Meta:
fields = ('id', 'start_time', 'end_time')
In this start_time in format of 2018-12-05T03:00:00+00:00
So I want to create a custom format for the start_time value in schema.
You can use the code like this:
start_time = fields.fields.DateTime(format='%Y-%m-%dT%H:%M:%S%z')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With