This is a multi-part message in MIME format.

------=_NextPart_000_0026_01C3B481.1A0482F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

All,=20

I have a function which returns a double and is show in a label. I need =
to convert the double to a time format. For example, if my double is =
1.73 then the time should be 2 hours and 13 minutes. How can I go about =
this?

Thanks,=20
Brian P. Hammer
------=_NextPart_000_0026_01C3B481.1A0482F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>All, </DIV>
<DIV>&nbsp;</DIV>
<DIV>I have a function which returns a double and is show in a =
label.&nbsp; I=20
need to convert the double to a time format.&nbsp; For example, if my =
double is=20
1.73 then the time should be 2 hours and 13 minutes.&nbsp; How can I go =
about=20
this?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks, <BR>Brian P. Hammer</DIV></BODY></HTML>

------=_NextPart_000_0026_01C3B481.1A0482F0--

Re: Converting Double to Date by Claes

Claes
Thu Nov 27 02:00:33 CST 2003

Use TimeSpan.FromHours

BTW, please don't post in HTML. Use plain text

/claes


****************************************
"Brian P. Hammer" <bphammer@hotmail.com> wrote in message
news:uD0DmNLtDHA.2448@TK2MSFTNGP12.phx.gbl...
All,

I have a function which returns a double and is show in a label. I need to
convert the double to a time format. For example, if my double is 1.73 then
the time should be 2 hours and 13 minutes. How can I go about this?

Thanks,
Brian P. Hammer



Re: Converting Double to Date by Jon

Jon
Thu Nov 27 03:38:44 CST 2003

Brian P. Hammer <bphammer@hotmail.com> wrote:
> I have a function which returns a double and is show in a label. I
> need to convert the double to a time format. For example, if my
> double is 1.73 then the time should be 2 hours and 13 minutes.
> How can I go about this?

Why would 1.73 mean 2 hours and 13 minutes? That suggests that the unit
of measurement is 76.87 minutes or so, which seems very odd to me. If
you can give more of an idea of the conversion you want, I'm sure we
can help.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Re: Converting Double to Date by Brian

Brian
Thu Nov 27 18:13:33 CST 2003

1 hour and 73 minuets or 1 hour and 1 hour and 13 minutes.

Anything that is above 60 needs to be added as an hour and then start back
over 0 minutes.

Here is what I do: I determine a distance between a start and end Latitude
and Longitude, divide it by an aircraft cruise speed, add (subtract) any
head winds and divide that by 24. This gives me a time that it would take to
make the distance. I think I might have figured it out below. It seems to
work.


Function ToDateTime(ByVal distance As Double) As DateTime
ToDateTime = Date.FromOADate(distance /
(ToDouble(Me.txtCruiseSpeed.Text) + ToDouble(Me.txtWind.Text)) / 24)
ToDateTime = ToDateTime.AddMinutes(Me.txtClimb.Text)
ToDateTime = ToDateTime.AddMinutes(Me.txtTaxi.Text)

Return ToDateTime

End Function


Does this look correct to you?

Thanks,

Brian P. Hammer

"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1a2fd67a7579d0c5989b4d@msnews.microsoft.com...
> Brian P. Hammer <bphammer@hotmail.com> wrote:
> > I have a function which returns a double and is show in a label. I
> > need to convert the double to a time format. For example, if my
> > double is 1.73 then the time should be 2 hours and 13 minutes.
> > How can I go about this?
>
> Why would 1.73 mean 2 hours and 13 minutes? That suggests that the unit
> of measurement is 76.87 minutes or so, which seems very odd to me. If
> you can give more of an idea of the conversion you want, I'm sure we
> can help.
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



Re: Converting Double to Date by Brian

Brian
Thu Nov 27 18:15:49 CST 2003

Thanks Claes, I think I have it figured it out but will read about timespan.

What's the deal with HTML? I did not know there was an issue.

I have to use HTM in other NG postings I make. Sometimes forget to switch.

--
Brian P. Hammer

"Claes Bergefall" <claes.bergefall.nospam@frontec.se> wrote in message
news:e0znHyLtDHA.2444@TK2MSFTNGP12.phx.gbl...
> Use TimeSpan.FromHours
>
> BTW, please don't post in HTML. Use plain text
>
> /claes
>
>
> ****************************************



Re: Converting Double to Date by Jon

Jon
Thu Nov 27 23:18:21 CST 2003

Brian P. Hammer <bphammer@hotmail.com> wrote:
> 1 hour and 73 minuets or 1 hour and 1 hour and 13 minutes.
>
> Anything that is above 60 needs to be added as an hour and then start back
> over 0 minutes.

So you're not really thinking of it as a quantity, you're thinking of
it as the decimal representation of the quantity. That ends up with
some very strange properties such as discontinuity. For instance:

1.99 = 3 hours and 19 minutes
2.00 = 2 hours

So adding a minute to 3 hours and 19 minutes actually takes away 1 hour
and 19 minutes...

Similarly, consider 1.5 hours: that's 1 hour and 50 minutes, right?
Divide by two and you get 0.75, which is 1 hour and 15 minutes, right?
Very strange...

> Here is what I do: I determine a distance between a start and end Latitude
> and Longitude, divide it by an aircraft cruise speed, add (subtract) any
> head winds and divide that by 24. This gives me a time that it would take to
> make the distance. I think I might have figured it out below. It seems to
> work.

Doing arithmetic on the kind of mapping you've described above won't
work in any sensible way, due to the discontinuities pointed out above.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Re: Converting Double to Date by Claes

Claes
Fri Nov 28 03:41:47 CST 2003

What newsgroups require that you post in HTML?
I've never seen one and I've been using newsgroups
since 1992!

Posting in HTML is generally frowned upon in the newsgroup
community since it is not rendered the same way across
different platforms. There are even newsreaders that can't
handle it at all so all they see is an error message.
And then there's also the virus thing...

It's just an advice. Even if you continue posting in HTML
I will still answer your questions (if I can).


/claes


"Brian P. Hammer" <bphammer@hotmail.com> wrote in message
news:eqrMITUtDHA.556@TK2MSFTNGP11.phx.gbl...
> Thanks Claes, I think I have it figured it out but will read about
timespan.
>
> What's the deal with HTML? I did not know there was an issue.
>
> I have to use HTM in other NG postings I make. Sometimes forget to
switch.
>
> --
> Brian P. Hammer
>
> "Claes Bergefall" <claes.bergefall.nospam@frontec.se> wrote in message
> news:e0znHyLtDHA.2444@TK2MSFTNGP12.phx.gbl...
> > Use TimeSpan.FromHours
> >
> > BTW, please don't post in HTML. Use plain text
> >
> > /claes
> >
> >
> > ****************************************
>
>



Re: Converting Double to Date by Brian

Brian
Fri Nov 28 14:37:29 CST 2003

Thanks, I was thought it might be a platform issue.

The NG is for my education at the University of Phoenix. We use Outlook
Express to "Go to Class" and it requires us to post in HTML, mainly to keep
formatting the same when we write papers.

--
Brian P. Hammer
"Claes Bergefall" <claes.bergefall.nospam@frontec.se> wrote in message
news:OfWxWPZtDHA.628@tk2msftngp13.phx.gbl...
> What newsgroups require that you post in HTML?
> I've never seen one and I've been using newsgroups
> since 1992!
>
> Posting in HTML is generally frowned upon in the newsgroup
> community since it is not rendered the same way across
> different platforms. There are even newsreaders that can't
> handle it at all so all they see is an error message.
> And then there's also the virus thing...
>
> It's just an advice. Even if you continue posting in HTML
> I will still answer your questions (if I can).
>
>
> /claes
>
>
> "Brian P. Hammer" <bphammer@hotmail.com> wrote in message
> news:eqrMITUtDHA.556@TK2MSFTNGP11.phx.gbl...
> > Thanks Claes, I think I have it figured it out but will read about
> timespan.
> >
> > What's the deal with HTML? I did not know there was an issue.
> >
> > I have to use HTM in other NG postings I make. Sometimes forget to
> switch.
> >
> > --
> > Brian P. Hammer
> >
> > "Claes Bergefall" <claes.bergefall.nospam@frontec.se> wrote in message
> > news:e0znHyLtDHA.2444@TK2MSFTNGP12.phx.gbl...
> > > Use TimeSpan.FromHours
> > >
> > > BTW, please don't post in HTML. Use plain text
> > >
> > > /claes
> > >
> > >
> > > ****************************************
> >
> >
>
>