[Django]-How to escape 'T' in django's date template tag

5👍

'Y-n-j\TH:i:s' works. See echo date('l jS \of F Y h:i:s A'); on this reference.

0👍

Standard datetime formatting requires preformatted characters to be surrounded in quotes. Try this:

DATETIME_FORMAT = "Y-n-j'T'H:i:s"

0👍

You should just use the c value on its own, which matches the standard ISO format – which is what your desired format is.

Leave a comment