Hi !
Use the DateFormat class...
For example:
DateFormat m_dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
or
DateFormat m_dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locale);
and provide a Locale to specify the formatting.
then just
String m_date = m_dateFormat.format(new Date());
Something like that...
Hope it helps.
What's not right on this:
SimpleDateFormat timeFormat = new SimpleDateFormat("H:mm:ss");
String s=timeFormat.format(new Date());
Time m_time = Time.valueOf(s);
return m_time;
The result column on the SQL Server is :
01/01/1900 17:13:53
I want only the time.
What does it print out if you add
SimpleDateFormat timeFormat = new SimpleDateFormat("H:mm:ss");
String s=timeFormat.format(new Date());
System.out.println(s);
Time m_time = Time.valueOf(s);
System.out.println(m_time);
Just the time or the date too...