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 convert d.m.Y to Y-m-d. I know how to do this in PHP but I need it in JavaScript.
First, pick the cells that contain dates, then right-click and select Format Cells. Select Custom in the Number Tab, then type 'dd-mmm-yyyy' in the Type text box, then click okay. It will format the dates you specify.
If you want to change the format in excel ,Click 'Home' Tab in the Ribbon-> In 'number 'Group->Choose 'more number format'-> 'custom'->change the 'type' as "DD-MM-YYYY". If you want to change the format when export it from SQL Server Database to excel.
1. Select a blank cell next to your date, for instance. I1, and type this formula =TEXT(G1, "yyyy-mm-dd"), and press Enter key, then drag AutoFill handle over the cells needed this formula. Now all dates are converted to texts and shown as yyyy-mm-dd format.
You can do this pretty simply. Just split the european date into an array, reverse it, and then join it with dashes.
var euro_date = '30.01.2010';
euro_date = euro_date.split('.');
var us_date = euro_date.reverse().join('-');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With