Forums Register Login

Date validation

+Pie Number of slices to send: Send
Hi all.

I am trying to get the time format in hh:mm format.
Below is the code that i used for that.




i wanted to get the output in "hh:mm" format but i am getting in form of
"hh:mm:ss".
Any help regarding this will be useful
Thanks
Ramya
+Pie Number of slices to send: Send
You'll need to format it during output as well, something like

System.out.println(myDateFormat.format(myTime));
[ October 24, 2005: Message edited by: Ulf Dittmer ]
+Pie Number of slices to send: Send
hi that is not working.
Because the return type of format() is string ,but i want the return type to be Date object.So to convert the string to Date if i use parse then again the output is in hh:mm:ss format,but i wanted it to be in hh:mm format.
+Pie Number of slices to send: Send
I'm a little confused. "Format" doesn't make sense for a Date object. Dates are only formatted when they become string representations of Dates. So the return type should be a String.

Perhaps what you want is to set the seconds of the date to zero? To do that, take a look at the Calendar class.
It's exactly the same and completely different as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1234 times.
Similar Threads
Problem with Date Object
Converting string to specific date format
string to date conversion
get time information from oracle DATE field
How to get Date Format of a System??
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:48:31.