How can I convert dd.mm.yyyy format date to yyyy-mm-dd format in JavaScript?
Here is an example:
30.01.2010
to
2010-01-30
Meaning
Datejs is a bit bloated if you only need to do this. You can use split()
and concatenate the results:
var eu_date = '30.01.2010';
var parts = eu_date.split('.');
var us_date = parts[2]+'-'+parts[1]+'-'+parts[0];
For these kinds of conversions where no date logic is needed, it's usually smartest to just use string manipulation tools.