PDA

Click to See Complete Forum and Search --> : Easy Date conversion


JonathanSchmidt
Nov 13th, 2002, 09:07 AM
Probably a simple one, but I am scared of Java. I have a date in DDMMYYYY format. I want to change it to MMDDYYYY and insert '/' in the proper places. What is the function to use?

DeadEyes
Nov 13th, 2002, 09:45 AM
Javascript:
var str = new String("ddmmyyyy");
str = str.substr(0,2) + "/" + str.substr(2,3) + "/" + str.substr(5,4);
//substr(beging,length)

Java kinda the same except
String str new String("ddmmmyyyy");
//substring(int beginIndex, int endIndex)