Hi,
You can use the java.util.StringTokenizer class as follows:
String sDate = "2001-10-11 00:00:00";
StringTokenizer sToken =
new StringTokenizer(sDate," ");
String datePart = sToken.nextToken();
sToken = new StringTokenizer(datePart,"-");
String yyyy = sToken.nextToken();
String mm = sToken.nextToken();
String dd = sToken.nextToken();
String yy = yyyy.substring(2,3);
StringBuffer sBuf = new StringBuffer( mm );
sBuf.append( "/" );
sBuf.append( dd );
sBuf.append( "/" );
sBuf.append( yy );
String mmddyy = sBuf.toString();
System.out.println( "Date: " + mmddyy );
This should print: 10/11/01
Hope the above code helps.
Cheers
Originally posted by john mattucci:
I have read all the posts and I havent really found an
answer to my question I was wondering the easist way to change
a Timestamp to the format mm/dd/yy eg i get 2001-10-01-00-00-00.... from timestamp what is an easy way to convert this to
10/01/01
Thank u for your time