How to change Django's start server time format?

When I start django server using following command:

python manage.py runserver

It shows current time likes:

 January 02, 2018 - 15:35:17

But I want to see time format:

January 02, 2018 - 3:35:17pm

How can I do it?

Thank you

Upvotes: 0

Views: 292

Answers (2)

Borut
Borut

Reputation: 3364

I don't understand why would some pretty much meaningless date and time and its format in the printout when you run development server be an issue. You cannot change that without changing source code. It's hardcoded. See source code here.

Upvotes: 1

karthik shankar
karthik shankar

Reputation: 117

The easiest solution that i found for doing this site wide would be to setting in your settings.py the following global variable:

TIME_INPUT_FORMATS = ['%I:%M %p',]

I hope this helps someone.

To use other formats see:

https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior

Upvotes: 1

Related Questions