﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18951	Datetime microseconds cutoff first zero in Django templates	olofom@…	Aymeric Augustin	"So I had a datetime object that I wanted to display on a web page and then post back through a hidden field. This didn't work (unless I use the 'c' flag with the date filter to get the ISO format, then it works fine).
[[BR]]



{{{
>>> datetime.datetime(2013, 9, 12, 9, 24, 16, 14070)
datetime.datetime(2013, 9, 12, 9, 24, 16, 14070)
>>> str(datetime.datetime(2013, 9, 12, 9, 24, 16, 14070))
'2013-09-12 09:24:16.014070'
}}}

[[BR]]


BUT {{ timestamp|date:'Y-m-d H:i:s.u' }} prints:
2013-09-12 09:24:16.14070
without the first zero. Then when trying to convert this back to a datetime object I get:
[[BR]]



{{{
>>> datetime.datetime.strptime('2013-09-12 09:24:16.14070', ""%Y-%m-%d %H:%M:%S.%f"")
datetime.datetime(2013, 9, 12, 9, 24, 16, 140700)
>>> str(datetime.datetime.strptime('2013-09-12 09:24:16.14070', ""%Y-%m-%d %H:%M:%S.%f""))
'2013-09-12 09:24:16.140700'
}}}

So in the end I ended up with the microseconds: 140700 instead of 014070, but the real bug is that the 'u' flag of date prints 14070 instead of 014070."	Bug	closed	Template system	1.4	Normal	fixed	datetime microseconds		Accepted	0	0	0	0	0	0
