I want datetime.now to return the datetime object in UK format. It does so on my local computer but when I upload the code to the server it does it in US format
I want datetime.now to return the datetime object in UK format.
There's no such concept, any more than an int
is a value "in hex" or "in decimal". A DateTime
is just a DateTime
- you can specify the format when you convert it to a string
. It's really important to understand the difference between an inherent value, and what it looks like after it's converted to text - very few types are aware of a custom, modifiable format to use when converting themselves - it's either provided externally (as for DateTime
, numbers etc) or simply fixed.
Before you convert start hard-coding a UK format though, I would strongly advise you to consider exactly what you're doing:
See more on this question at Stackoverflow