Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting format and value in input type="date"

Is there any way to set the format of <input type="date" /> ? if no then how can i set date in this field using JavaScript in the default format of type="date". how can i get what will be the format of this field?

EDIT : Actually i want to show native date-picker of mobile device that's why i picked this type of input. if is there any alternate for that field that also will b good to have.

Sorry if i said anything stupid. Please guide me

like image 491
muneebShabbir Avatar asked May 27 '13 09:05

muneebShabbir


People also ask

How do I change the format of a date field?

Right-click the date field, and then click Properties. In the Property Sheet, select the format you want from the Format property list.


2 Answers

The format is YYYY-MM-DD. You cannot change it.

$('#myinput').val('2013-12-31'); sets value

like image 173
wachme Avatar answered Nov 02 '22 04:11

wachme


new Date().toISOString().split('T')[0];

like image 22
Sarkis Arutiunian Avatar answered Nov 02 '22 04:11

Sarkis Arutiunian