dateformat

Hi, I go a small prob, hope someone can help mi

String past = "30/12/01";

java.text.SimpleDateFormat x = new java.text.SimpleDateFormat("dd/mm/yy");

java.util.Date mypastDate = x.parse(past);

out.println(mypastDate);

by right, this output should be 30/12/01 but it give mi this output, how come?

Tue Jan 30 00:12:00 GMT+08:00 2001

anyone? thx!

[400 byte] By [des_xu] at [2007-9-26 2:26:20]
# 1
hi,replace you pattern : "dd/mm/yy" by "dd/MM/yy"Badr.
zbadr at 2007-6-29 9:39:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

hi,y can see this sample:

<%

String past = "30/12/01";

java.text.SimpleDateFormat x = new java.text.SimpleDateFormat("dd/mm/yy");

java.util.Date mypastDate = x.parse(past);

//out.println(mypastDate.toString());

String lsh = x.format(x.parse(past));

out.println(lsh);

%>

liyonghai at 2007-6-29 9:39:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
okie, thanks alot guys!
des_xu at 2007-6-29 9:39:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...