In a Jsp I've got a input date String formatting as “Aug-6-2009”,how to change that to "2009-08-06" so that Mysql can read.
Maybe i need regex?
That may seem to be a easy question,but bear with me.
In a Jsp I've got a input date String formatting as “Aug-6-2009”,how to change that to "2009-08-06" so that Mysql can read.
Maybe i need regex?
That may seem to be a easy question,but bear with me.
You can use a SimpleDateFormat
object's .parse()
and .format()
methods to get a string in the format you need.
http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html