To change the format of Django DateTimeField

Asked 2 years ago, Updated 2 years ago, 53 views

How can I save it in the format I want when I save it in db? (For example, '%Y/%m/%d %H:%M:%S)

django

2022-09-21 21:20

1 Answers

t = forms.DateTimeField(input_formats=['%Y/%m/%d %H:%M:%S'])

You can save it like this.


2022-09-21 21:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.