I'm trying to filter date from timestamp in Django template ,
(Input:)2019-03-23T18:51:05.253658
to (Output:)2019-03-23
.Anyone please help me on this?
First You need to update settings.py
settings.py
DATE_INPUT_FORMATS = [
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
]
Forms.py
FromDate = forms.DateField(input_formats=['%d %b %Y'], widget=forms.DateInput(
attrs=
{
'class' : "form-control col-md-7 col-xs-12
}
))
In input_formats you can change Date format