M
mike
I have a data like:
03-Jul-05
and need to convert it to:
7/3/2005
Is there a function for this already?
03-Jul-05
and need to convert it to:
7/3/2005
Is there a function for this already?
mike said:I have a data like:
03-Jul-05
and need to convert it to:
7/3/2005
Is there a function for this already?
There are a number of date function libs around.
Using mine from http://www.javascripttoolbox.com/date/ you could simply do:
var d = "03-Jul-05";
var formatted = formatDate(new
Date(getDateFromFormat(d,"d-MMM-yy")),"M/d/yyyy");
If your case is very specific, you could surely avoid using a big library
and instead use regular expressions to perform the task. Less code, but also
less flexibility. Depends on what you really need.
PS: Ignore John Stockton's comment which is surely coming, complaining about
converting from a good format to a dumb "American" one.
mike said:yeah, i'm trying to understand what is going on in that script, not not
just plug a bunch of code in my page without learning anything.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.