Please can one help me with a better way of Converting Date( in Hour and Minutes) in to Double or Integers.
I want to use it for arithmetic purpose
e.g, if the Date Input is 6 hrs:30min, then i want it converted in to 6.5, ....or 12 hrs: 15 min into 12.25. I will appreciate if any programmer can help me out..

Recommended Answers

All 3 Replies

There are several classes for dealing with dates. Date and Calendar for example.

If the times are as simple as your example, then take the minutes divide by 60 and add to the hours.

Thanks.I actually thought of that already. But, i thought there could a class that could get date and parse it into double or integer directly just as is been done in VBasic. I appreciate your help.

The Date and Calendar classes will do the parsing and give you access to the value as a nunber of milliseconds since <some date/time that I can't remember now> in a long integer, which is exactly what you need for calculating intervals etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.