I have a date in a format like this fecha2.value = '2014-01-06'
, but I want to change the format to this '01-06-14'
using jQuery.
How can I do this? Thanks in advance.
I have a date in a format like this fecha2.value = '2014-01-06'
, but I want to change the format to this '01-06-14'
using jQuery.
How can I do this? Thanks in advance.
I dont think you need to use jQuery at all, just simple JavaScript...
Save the date as a string:
Split the string to get the day, month & year values...
Rejoin into final date string:
You can use date.js to achieve this:
Alternatively, you can do it natively like this:
You don't need any date-specific functions for this, it's just string manipulation:
You can change this as your need..