A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Joined: Jan 08, 2010
Aug 17, 2010 22:48:15
I am getting the time from the calander like below
time = "16:10";
How would I convert to 1610?
How would I remove the : from 16:10?
Joined: Jun 19, 2010
Aug 17, 2010 23:10:17
If you are starting with a
object i would use a date format ie.
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("hhmm"); format.format(calendar.getTime());
If you are convinced you need to use a string just use the replace method on the String object ie.
String time = "12:20"; time = time.replace(":", "");
I agree. Here's the link:
how do i compare row by row
Generate random strings
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015