This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes convert time to double Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert time to double " Watch "convert time to double " New topic
Author

convert time to double

Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Hi all I want to convert time to double as if suppose now time is 11hr and 40min . then I want to convert this into double as 11.40 how to do this?



Life is easy because we write the source code.....
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Is it okay? any better solution?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

That would work, but I wonder why you would want to do that.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

11.40 isn't an accurate representation of 11:40. You'd need to divide the minutes by 60, not 100, giving 11.66666666.... If you only need it for displaying use SimpleDateFormat instead.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert time to double
 
Similar Threads
GregorianCalendar object
3 Oct 2010 only has 23 hours?
Converting double to int.
Math on Time of Day
convert timestamp to double