473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DateTime AddMinutes Format Issue

I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.

For example:

DateTime.Now.AddMinutes(30) returns "00:30"

DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"

DateTime.Now.AdMinutes(-45)) returns "-00:45"

I've tried all kinds of Format specifiers and nothing is working, any help
is appreciated.

TIA,

--
Fritz
Nov 16 '05 #1
15 14234
Fritz,
Can you give a more complete example of what you are doing, and what you
expect?

As using the following:

Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");

I get:

30: 7/19/2004 11:07:57 AM
90: 7/19/2004 12:07:57 PM
-45: 7/19/2004 9:52:57 AM

To limit the returned value to HH:MM I would use the ToString method with a
custom format, something like:

Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"), "30")
Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"), "90")
Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"),
"-45")

30: 11:10
90: 12:10
-45: 09:55

For details on custom datetime formats see:

http://msdn.microsoft.com/library/de...matstrings.asp

For information on formatting in .NET in general see:
http://msdn.microsoft.com/library/de...ttingtypes.asp

Hope this helps
Jay


"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.

For example:

DateTime.Now.AddMinutes(30) returns "00:30"

DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"

DateTime.Now.AdMinutes(-45)) returns "-00:45"

I've tried all kinds of Format specifiers and nothing is working, any help
is appreciated.

TIA,

--
Fritz

Nov 16 '05 #2
Sounds like you want to be using the timespan.

Ex:
TimeSpan ts = DateTime.Now.AddMinutes(30) - DateTime.Now;
string output = ts.ToString("hh:mm");

--
Adam Clauss
ca*****@tamu.edu
"Fritz Switzer" <fr***********@abletfactory.com> wrote in message news:u1**************@TK2MSFTNGP10.phx.gbl...
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.

For example:

DateTime.Now.AddMinutes(30) returns "00:30"

DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"

DateTime.Now.AdMinutes(-45)) returns "-00:45"

I've tried all kinds of Format specifiers and nothing is working, any help
is appreciated.

TIA,

--
Fritz

Nov 16 '05 #3
Adam,
As a short hand to " - DateTime.Now" you can use DateTime.TimeOfDay.
TimeSpan ts = DateTime.Now.AddMinutes(30).TimeOfDay;
string output = ts.ToString();
More importantly TimeSpan.ToString does not have any overloads, it returns
the value in a fixed format.

Hope this helps
Jay

"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl... Sounds like you want to be using the timespan.

Ex:
TimeSpan ts = DateTime.Now.AddMinutes(30) - DateTime.Now;
string output = ts.ToString("hh:mm");

--
Adam Clauss
ca*****@tamu.edu
"Fritz Switzer" <fr***********@abletfactory.com> wrote in message

news:u1**************@TK2MSFTNGP10.phx.gbl...
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.

For example:

DateTime.Now.AddMinutes(30) returns "00:30"

DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"

DateTime.Now.AdMinutes(-45)) returns "-00:45"

I've tried all kinds of Format specifiers and nothing is working, any help is appreciated.

TIA,

--
Fritz

Nov 16 '05 #4
Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
Fritz,
Can you give a more complete example of what you are doing, and what you
expect?

Thanks Jay, here is more detail.

I'm using a random function that adds (- minutes) to the current time.
PickTime returns a negative number between 1-120. When the value is
returned the newTime is okay but just gives me total minutes , I just want
to format the result in hh:mm format. So if 95 minutes is returned I want
newTime to be "01:35" or if 46 is returned "00:46".

sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString();

So in your example:
Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
I'm looking to get 00:45 returned rather than.
-45: 7/19/2004 9:52:57 AM
It is being used as a "simulation", the value is attached to a timertick and
gets updated as time progresses. This seeds a value and the elapsed time is
updated with each tick, in this case, I'm updating a display every minute So
after 20 minutes the display using the above example of -45 I want the
value to be 01:05 (45+20 minutes or 1 hr 20 minutes)

hope that helps.





As using the following:

Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");

I get:

30: 7/19/2004 11:07:57 AM
90: 7/19/2004 12:07:57 PM
-45: 7/19/2004 9:52:57 AM

To limit the returned value to HH:MM I would use the ToString method with a custom format, something like:

Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"), "30") Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"), "90") Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"),
"-45")

30: 11:10
90: 12:10
-45: 09:55

For details on custom datetime formats see:

http://msdn.microsoft.com/library/de...matstrings.asp
For information on formatting in .NET in general see:
http://msdn.microsoft.com/library/de...ttingtypes.asp
Hope this helps
Jay


"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.

For example:

DateTime.Now.AddMinutes(30) returns "00:30"

DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"

DateTime.Now.AdMinutes(-45)) returns "-00:45"

I've tried all kinds of Format specifiers and nothing is working, any help is appreciated.

TIA,

--
Fritz


Nov 16 '05 #5
Ahh... my mistake, I glanced at the MSDN docs on it too quickly (I saw the table listing the different parts, assumed it was
overloaded). Odd, though, that they did not overload it in the same manner as DateTime.

--
Adam Clauss
ca*****@tamu.edu
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:Ox**************@TK2MSFTNGP10.phx.gbl...
Adam,
As a short hand to " - DateTime.Now" you can use DateTime.TimeOfDay.
TimeSpan ts = DateTime.Now.AddMinutes(30).TimeOfDay;
string output = ts.ToString();


More importantly TimeSpan.ToString does not have any overloads, it returns
the value in a fixed format.

Hope this helps
Jay

"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
Sounds like you want to be using the timespan.

Ex:
TimeSpan ts = DateTime.Now.AddMinutes(30) - DateTime.Now;
string output = ts.ToString("hh:mm");

--
Adam Clauss
ca*****@tamu.edu
"Fritz Switzer" <fr***********@abletfactory.com> wrote in message

news:u1**************@TK2MSFTNGP10.phx.gbl...
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.

For example:

DateTime.Now.AddMinutes(30) returns "00:30"

DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"

DateTime.Now.AdMinutes(-45)) returns "-00:45"

I've tried all kinds of Format specifiers and nothing is working, any help is appreciated.

TIA,

--
Fritz



Nov 16 '05 #6
Fritz,
I still don't follow you.

If your function returns 95, do you literally want "01:35" or do you want
"09:52" (which is Now - 95 minutes).

It sounds like you want "01:35", in which case you do not want to do
anything with DateTime.Now!

I would simply add minutes to DateTime.MinValue:

string newTime =
DateTime.MinValue.AddMinutes(PickTime()).ToString( "hh:mm");

If you want "09:52" (Now - 95 minutes), then use DateTime.Now:

sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString("hh:mm");

If you have a specific time in mind, then use it:

DateTime whenever;
sting newTime =whenever.AddMinutes(-PickTime()).ToString("hh:mm");

In either case to the time formatted, you need to use
DateTime.ToString("hh:mm"), see my first reply for details on formatting.

Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
Fritz,
Can you give a more complete example of what you are doing, and what you
expect?

Thanks Jay, here is more detail.

I'm using a random function that adds (- minutes) to the current time.
PickTime returns a negative number between 1-120. When the value is
returned the newTime is okay but just gives me total minutes , I just want
to format the result in hh:mm format. So if 95 minutes is returned I want
newTime to be "01:35" or if 46 is returned "00:46".

sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString();

So in your example:
Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");


I'm looking to get 00:45 returned rather than.
-45: 7/19/2004 9:52:57 AM


It is being used as a "simulation", the value is attached to a timertick

and gets updated as time progresses. This seeds a value and the elapsed time is updated with each tick, in this case, I'm updating a display every minute So after 20 minutes the display using the above example of -45 I want the
value to be 01:05 (45+20 minutes or 1 hr 20 minutes)

hope that helps.





As using the following:

Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");

I get:

30: 7/19/2004 11:07:57 AM
90: 7/19/2004 12:07:57 PM
-45: 7/19/2004 9:52:57 AM

To limit the returned value to HH:MM I would use the ToString method with
a
custom format, something like:

Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"),

"30")
Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"),

"90")
Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"),
"-45")

30: 11:10
90: 12:10
-45: 09:55

For details on custom datetime formats see:

http://msdn.microsoft.com/library/de...matstrings.asp

For information on formatting in .NET in general see:

http://msdn.microsoft.com/library/de...ttingtypes.asp

Hope this helps
Jay


"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.

For example:

DateTime.Now.AddMinutes(30) returns "00:30"

DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"

DateTime.Now.AdMinutes(-45)) returns "-00:45"

I've tried all kinds of Format specifiers and nothing is working, any

help is appreciated.

TIA,

--
Fritz



Nov 16 '05 #7
Adam,
Odd, though, that they did not overload it in the same manner as DateTime. I would expect it to be overloaded also, as sometimes I want to custom
format the Timespan, as this example just hours & minutes (no seconds).

Maybe we'll have to submit a suggestion for VS.NET 2005 at:

http://lab.msdn.microsoft.com/vs2005/

Jay

"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:e$****************@TK2MSFTNGP10.phx.gbl... Ahh... my mistake, I glanced at the MSDN docs on it too quickly (I saw the table listing the different parts, assumed it was overloaded). Odd, though, that they did not overload it in the same manner as DateTime.
--
Adam Clauss
ca*****@tamu.edu
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message

news:Ox**************@TK2MSFTNGP10.phx.gbl...
Adam,
As a short hand to " - DateTime.Now" you can use DateTime.TimeOfDay.
TimeSpan ts = DateTime.Now.AddMinutes(30).TimeOfDay;
string output = ts.ToString();


More importantly TimeSpan.ToString does not have any overloads, it returns the value in a fixed format.

Hope this helps
Jay

"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
Sounds like you want to be using the timespan.

Ex:
TimeSpan ts = DateTime.Now.AddMinutes(30) - DateTime.Now;
string output = ts.ToString("hh:mm");

--
Adam Clauss
ca*****@tamu.edu
"Fritz Switzer" <fr***********@abletfactory.com> wrote in message

news:u1**************@TK2MSFTNGP10.phx.gbl...
> I'd like to have a string assigned the value of a
> DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" > format.
>
> For example:
>
> DateTime.Now.AddMinutes(30) returns "00:30"
>
> DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"
>
> DateTime.Now.AdMinutes(-45)) returns "-00:45"
>
> I've tried all kinds of Format specifiers and nothing is working,
any help
> is appreciated.
>
> TIA,
>
> --
> Fritz
>
>


Nov 16 '05 #8
Thanks Jay/Adam,

If your function returns 95, do you literally want "01:35" or do you want
"09:52" (which is Now - 95 minutes).
I want "01:35"

It sounds like you want "01:35", in which case you do not want to do
anything with DateTime.Now!

Here are some additional details. I'm simulating a "doctors office", I want
to display the length in time (in "hh:mm") someone is waiting. I first
start by randomly assigning a time from -(1-120 minutes) so I use
DateTime.Now.AddMinutes(negative random amount). This then gives me length
of time, I'm just using minutes. So patient 1 = 35 minutes, patient 2= 65
minutes patient 3= 90 minutes . Now I need to display the time in a grid
control with the waiting time in "hh:mm" format, and just to make things
more complicated also sorted by longest wait time to shortest wait time.
So I can get 01:30, 01:05, and 00:35. After two minutes the display should
read 01:32, 01:07, 00:37. A timer is updating the display every minute.

hope that clears up things,

Thanks, appreciate the help.

Fritz

In either case to the time formatted, you need to use
DateTime.ToString("hh:mm"), see my first reply for details on formatting.


Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
Fritz,
Can you give a more complete example of what you are doing, and what you expect?

Thanks Jay, here is more detail.

I'm using a random function that adds (- minutes) to the current time.
PickTime returns a negative number between 1-120. When the value is
returned the newTime is okay but just gives me total minutes , I just want
to format the result in hh:mm format. So if 95 minutes is returned I want newTime to be "01:35" or if 46 is returned "00:46".

sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString();

So in your example:
Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");


I'm looking to get 00:45 returned rather than.
-45: 7/19/2004 9:52:57 AM


It is being used as a "simulation", the value is attached to a timertick

and
gets updated as time progresses. This seeds a value and the elapsed time

is
updated with each tick, in this case, I'm updating a display every minute So
after 20 minutes the display using the above example of -45 I want the
value to be 01:05 (45+20 minutes or 1 hr 20 minutes)

hope that helps.





As using the following:

Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");

I get:

30: 7/19/2004 11:07:57 AM
90: 7/19/2004 12:07:57 PM
-45: 7/19/2004 9:52:57 AM

To limit the returned value to HH:MM I would use the ToString method

with
a
custom format, something like:

Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"),

"30")
Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"),

"90")
Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"), "-45")

30: 11:10
90: 12:10
-45: 09:55

For details on custom datetime formats see:

http://msdn.microsoft.com/library/de...matstrings.asp

For information on formatting in .NET in general see:

http://msdn.microsoft.com/library/de...ttingtypes.asp

Hope this helps
Jay


"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...
> I'd like to have a string assigned the value of a
> DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" > format.
>
> For example:
>
> DateTime.Now.AddMinutes(30) returns "00:30"
>
> DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"
>
> DateTime.Now.AdMinutes(-45)) returns "-00:45"
>
> I've tried all kinds of Format specifiers and nothing is working,

any help
> is appreciated.
>
> TIA,
>
> --
> Fritz
>
>



Nov 16 '05 #9
Fritz,
I have to ask, is this a home work assignment? Your questions & troubles
make this sounds suspiciously like a home work assignment. If it is I
strongly recommend you stop "cheating", if not, my apologies, proceed. Thank
you for understanding either way.

It really sounds like you are confusing:
- current time
- entry time
- elapsed time

As Now.AddMinutes(negative) will simulate entry time.

Now will simulate current time.

elapsed time = entry time - current time

It sounds like you want your grid to display elapsed time.

I would consider binding your Grid Control to a custom object, that has two
properties, as the custom object will allow you to easily update the elapsed
time value.

This custom object would need an Entry & an Elapsed property. Where you set
Entry to your Now.AddMinutes(negative), and Elapsed is Now.Subtract(Entry)

Note DateTime.Subtract will give you a TimeSpan, which you cannot custom
format, if you only want Elapsed to show hours & minutes I would add the
TimeSpan to DateTime.MinValue to convert it back to a DateTime...

Alternatively you could bind to a dataset, where you use a timer object and
& for loop to update the elapsed column of each row...

Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eA**************@tk2msftngp13.phx.gbl...
Thanks Jay/Adam,

If your function returns 95, do you literally want "01:35" or do you want
"09:52" (which is Now - 95 minutes).
I want "01:35"

It sounds like you want "01:35", in which case you do not want to do
anything with DateTime.Now!


Here are some additional details. I'm simulating a "doctors office", I

want to display the length in time (in "hh:mm") someone is waiting. I first
start by randomly assigning a time from -(1-120 minutes) so I use
DateTime.Now.AddMinutes(negative random amount). This then gives me length of time, I'm just using minutes. So patient 1 = 35 minutes, patient 2= 65
minutes patient 3= 90 minutes . Now I need to display the time in a grid control with the waiting time in "hh:mm" format, and just to make things
more complicated also sorted by longest wait time to shortest wait time.
So I can get 01:30, 01:05, and 00:35. After two minutes the display should read 01:32, 01:07, 00:37. A timer is updating the display every minute.

hope that clears up things,

Thanks, appreciate the help.

Fritz

In either case to the time formatted, you need to use
DateTime.ToString("hh:mm"), see my first reply for details on formatting.



Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:Of**************@tk2msftngp13.phx.gbl...
> Fritz,
> Can you give a more complete example of what you are doing, and what

you > expect?
>

Thanks Jay, here is more detail.

I'm using a random function that adds (- minutes) to the current time.
PickTime returns a negative number between 1-120. When the value is
returned the newTime is okay but just gives me total minutes , I just want to format the result in hh:mm format. So if 95 minutes is returned I want newTime to be "01:35" or if 46 is returned "00:46".

sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString();

So in your example:

> Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");

I'm looking to get 00:45 returned rather than.

> -45: 7/19/2004 9:52:57 AM

It is being used as a "simulation", the value is attached to a timertick and
gets updated as time progresses. This seeds a value and the elapsed
time
is
updated with each tick, in this case, I'm updating a display every

minute
So
after 20 minutes the display using the above example of -45 I want

the value to be 01:05 (45+20 minutes or 1 hr 20 minutes)

hope that helps.






> As using the following:
>
> Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
> Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
> Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
>
> I get:
>
> 30: 7/19/2004 11:07:57 AM
> 90: 7/19/2004 12:07:57 PM
> -45: 7/19/2004 9:52:57 AM
>
> To limit the returned value to HH:MM I would use the ToString method

with
a
> custom format, something like:
>
> Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"), "30")
> Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"), "90")
>

Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"), > "-45")
>
> 30: 11:10
> 90: 12:10
> -45: 09:55
>
> For details on custom datetime formats see:
>
>

http://msdn.microsoft.com/library/de...matstrings.asp
>
> For information on formatting in .NET in general see:
>

http://msdn.microsoft.com/library/de...ttingtypes.asp
>
> Hope this helps
> Jay
>
>
>
>
> "Fritz Switzer" <fr***********@abletfactory.com> wrote in message
> news:u1**************@TK2MSFTNGP10.phx.gbl...
> > I'd like to have a string assigned the value of a
> > DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" > > format.
> >
> > For example:
> >
> > DateTime.Now.AddMinutes(30) returns "00:30"
> >
> > DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"
> >
> > DateTime.Now.AdMinutes(-45)) returns "-00:45"
> >
> > I've tried all kinds of Format specifiers and nothing is working, any help
> > is appreciated.
> >
> > TIA,
> >
> > --
> > Fritz
> >
> >
>
>



Nov 16 '05 #10
Jay/Adam,

Not a "homework" assignment, real work. No apologies necessary and I
understand.

The requirement is for a grid control to show an elapsed time formatted in
"hh:mm", with the time in descending order. During development, I need to
simulate elapsed time, hence the seeding with the previous times for testing
only.

The confusion is finding the correct formating for "strings", "DateTime" and
"TimeSpan" and doing the calculations to show the elapsed time in "hh:mm".

The suggestions from both Jay and Adam have very been helpful.

Much appreciated.

--
Fritz
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:OI****************@TK2MSFTNGP12.phx.gbl...
Fritz,
I have to ask, is this a home work assignment? Your questions & troubles
make this sounds suspiciously like a home work assignment. If it is I
strongly recommend you stop "cheating", if not, my apologies, proceed. Thank you for understanding either way.

It really sounds like you are confusing:
- current time
- entry time
- elapsed time

As Now.AddMinutes(negative) will simulate entry time.

Now will simulate current time.

elapsed time = entry time - current time

It sounds like you want your grid to display elapsed time.

I would consider binding your Grid Control to a custom object, that has two properties, as the custom object will allow you to easily update the elapsed time value.

This custom object would need an Entry & an Elapsed property. Where you set Entry to your Now.AddMinutes(negative), and Elapsed is Now.Subtract(Entry)
Note DateTime.Subtract will give you a TimeSpan, which you cannot custom
format, if you only want Elapsed to show hours & minutes I would add the
TimeSpan to DateTime.MinValue to convert it back to a DateTime...

Alternatively you could bind to a dataset, where you use a timer object and & for loop to update the elapsed column of each row...

Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eA**************@tk2msftngp13.phx.gbl...
Thanks Jay/Adam,

If your function returns 95, do you literally want "01:35" or do you want "09:52" (which is Now - 95 minutes).


I want "01:35"

It sounds like you want "01:35", in which case you do not want to do
anything with DateTime.Now!


Here are some additional details. I'm simulating a "doctors office", I

want
to display the length in time (in "hh:mm") someone is waiting. I first
start by randomly assigning a time from -(1-120 minutes) so I use
DateTime.Now.AddMinutes(negative random amount). This then gives me

length
of time, I'm just using minutes. So patient 1 = 35 minutes, patient 2= 65
minutes patient 3= 90 minutes . Now I need to display the time in a

grid
control with the waiting time in "hh:mm" format, and just to make things more complicated also sorted by longest wait time to shortest wait time. So I can get 01:30, 01:05, and 00:35. After two minutes the display

should
read 01:32, 01:07, 00:37. A timer is updating the display every minute.

hope that clears up things,

Thanks, appreciate the help.

Fritz

In either case to the time formatted, you need to use
DateTime.ToString("hh:mm"), see my first reply for details on formatting.



Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
> Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in

message > news:Of**************@tk2msftngp13.phx.gbl...
> > Fritz,
> > Can you give a more complete example of what you are doing, and what you
> > expect?
> >
>
> Thanks Jay, here is more detail.
>
> I'm using a random function that adds (- minutes) to the current
time. > PickTime returns a negative number between 1-120. When the value is
> returned the newTime is okay but just gives me total minutes , I just
want
> to format the result in hh:mm format. So if 95 minutes is returned
I want
> newTime to be "01:35" or if 46 is returned "00:46".
>
> sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString();
>
> So in your example:
>
> > Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
>
> I'm looking to get 00:45 returned rather than.
>
> > -45: 7/19/2004 9:52:57 AM
>
>
>
> It is being used as a "simulation", the value is attached to a timertick and
> gets updated as time progresses. This seeds a value and the elapsed time is
> updated with each tick, in this case, I'm updating a display every

minute
So
> after 20 minutes the display using the above example of -45 I want the > value to be 01:05 (45+20 minutes or 1 hr 20 minutes)
>
> hope that helps.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> > As using the following:
> >
> > Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
> > Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
> > Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
> >
> > I get:
> >
> > 30: 7/19/2004 11:07:57 AM
> > 90: 7/19/2004 12:07:57 PM
> > -45: 7/19/2004 9:52:57 AM
> >
> > To limit the returned value to HH:MM I would use the ToString
method with
> a
> > custom format, something like:
> >
> >

Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"), > "30")
> > Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"), > "90")
> >

Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"),
> > "-45")
> >
> > 30: 11:10
> > 90: 12:10
> > -45: 09:55
> >
> > For details on custom datetime formats see:
> >
> >
>

http://msdn.microsoft.com/library/de...matstrings.asp
> >
> > For information on formatting in .NET in general see:
> >
>

http://msdn.microsoft.com/library/de...ttingtypes.asp
> >
> > Hope this helps
> > Jay
> >
> >
> >
> >
> > "Fritz Switzer" <fr***********@abletfactory.com> wrote in message
> > news:u1**************@TK2MSFTNGP10.phx.gbl...
> > > I'd like to have a string assigned the value of a
> > > DateTime.AddMinutes(amount) so that the string is formatted in

"HH:MM"
> > > format.
> > >
> > > For example:
> > >
> > > DateTime.Now.AddMinutes(30) returns "00:30"
> > >
> > > DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"
> > >
> > > DateTime.Now.AdMinutes(-45)) returns "-00:45"
> > >
> > > I've tried all kinds of Format specifiers and nothing is

working, any
> help
> > > is appreciated.
> > >
> > > TIA,
> > >
> > > --
> > > Fritz
> > >
> > >
> >
> >
>
>



Nov 16 '05 #11
Fritz,
Neither "String" nor "TimeSpan" support custom formatting. So your elapsed
time will need to be a DateTime. If you make it a DateTime, you can use
"hh:mm" for the format. Note it needs to be lower case, as "MM" is months...

Post if you really need help in how to get the grid to use your formatting.

Hope this helps
Jay
"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:uO*************@tk2msftngp13.phx.gbl...
Jay/Adam,

Not a "homework" assignment, real work. No apologies necessary and I
understand.

The requirement is for a grid control to show an elapsed time formatted in
"hh:mm", with the time in descending order. During development, I need to
simulate elapsed time, hence the seeding with the previous times for testing only.

The confusion is finding the correct formating for "strings", "DateTime" and "TimeSpan" and doing the calculations to show the elapsed time in "hh:mm".

The suggestions from both Jay and Adam have very been helpful.

Much appreciated.

--
Fritz
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:OI****************@TK2MSFTNGP12.phx.gbl...
Fritz,
I have to ask, is this a home work assignment? Your questions & troubles
make this sounds suspiciously like a home work assignment. If it is I
strongly recommend you stop "cheating", if not, my apologies, proceed. Thank
you for understanding either way.

It really sounds like you are confusing:
- current time
- entry time
- elapsed time

As Now.AddMinutes(negative) will simulate entry time.

Now will simulate current time.

elapsed time = entry time - current time

It sounds like you want your grid to display elapsed time.

I would consider binding your Grid Control to a custom object, that has

two
properties, as the custom object will allow you to easily update the

elapsed
time value.

This custom object would need an Entry & an Elapsed property. Where you

set
Entry to your Now.AddMinutes(negative), and Elapsed is

Now.Subtract(Entry)

Note DateTime.Subtract will give you a TimeSpan, which you cannot custom
format, if you only want Elapsed to show hours & minutes I would add the
TimeSpan to DateTime.MinValue to convert it back to a DateTime...

Alternatively you could bind to a dataset, where you use a timer object

and
& for loop to update the elapsed column of each row...

Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eA**************@tk2msftngp13.phx.gbl...
Thanks Jay/Adam,
> If your function returns 95, do you literally want "01:35" or do you

want
> "09:52" (which is Now - 95 minutes).

I want "01:35"

>
> It sounds like you want "01:35", in which case you do not want to do
> anything with DateTime.Now!
>

Here are some additional details. I'm simulating a "doctors office", I
want
to display the length in time (in "hh:mm") someone is waiting. I
first start by randomly assigning a time from -(1-120 minutes) so I use
DateTime.Now.AddMinutes(negative random amount). This then gives me

length
of time, I'm just using minutes. So patient 1 = 35 minutes, patient 2= 65 minutes patient 3= 90 minutes . Now I need to display the time in a grid
control with the waiting time in "hh:mm" format, and just to make things more complicated also sorted by longest wait time to shortest wait time. So I can get 01:30, 01:05, and 00:35. After two minutes the display

should
read 01:32, 01:07, 00:37. A timer is updating the display every
minute.
hope that clears up things,

Thanks, appreciate the help.

Fritz


> In either case to the time formatted, you need to use
> DateTime.ToString("hh:mm"), see my first reply for details on

formatting.



>
> Hope this helps
> Jay
>
> "Fritz Switzer" <fr***********@abletfactory.com> wrote in message
> news:eZ**************@TK2MSFTNGP10.phx.gbl...
> > Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in

message
> > news:Of**************@tk2msftngp13.phx.gbl...
> > > Fritz,
> > > Can you give a more complete example of what you are doing, and what you
> > > expect?
> > >
> >
> > Thanks Jay, here is more detail.
> >
> > I'm using a random function that adds (- minutes) to the current time. > > PickTime returns a negative number between 1-120. When the value is > > returned the newTime is okay but just gives me total minutes , I just want
> > to format the result in hh:mm format. So if 95 minutes is returned I
want
> > newTime to be "01:35" or if 46 is returned "00:46".
> >
> > sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString();
> >
> > So in your example:
> >
> > > Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
> >
> > I'm looking to get 00:45 returned rather than.
> >
> > > -45: 7/19/2004 9:52:57 AM
> >
> >
> >
> > It is being used as a "simulation", the value is attached to a

timertick
> and
> > gets updated as time progresses. This seeds a value and the
elapsed time
> is
> > updated with each tick, in this case, I'm updating a display every
minute
> So
> > after 20 minutes the display using the above example of -45 I
want the
> > value to be 01:05 (45+20 minutes or 1 hr 20 minutes)
> >
> > hope that helps.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > As using the following:
> > >
> > > Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
> > > Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
> > > Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
> > >
> > > I get:
> > >
> > > 30: 7/19/2004 11:07:57 AM
> > > 90: 7/19/2004 12:07:57 PM
> > > -45: 7/19/2004 9:52:57 AM
> > >
> > > To limit the returned value to HH:MM I would use the ToString

method > with
> > a
> > > custom format, something like:
> > >
> > >

Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"),
> > "30")
> > >

Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"),
> > "90")
> > >
Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"),
> > > "-45")
> > >
> > > 30: 11:10
> > > 90: 12:10
> > > -45: 09:55
> > >
> > > For details on custom datetime formats see:
> > >
> > >
> >
>

http://msdn.microsoft.com/library/de...matstrings.asp > > >
> > > For information on formatting in .NET in general see:
> > >
> >
>

http://msdn.microsoft.com/library/de...ttingtypes.asp
> > >
> > > Hope this helps
> > > Jay
> > >
> > >
> > >
> > >
> > > "Fritz Switzer" <fr***********@abletfactory.com> wrote in message > > > news:u1**************@TK2MSFTNGP10.phx.gbl...
> > > > I'd like to have a string assigned the value of a
> > > > DateTime.AddMinutes(amount) so that the string is formatted in
"HH:MM"
> > > > format.
> > > >
> > > > For example:
> > > >
> > > > DateTime.Now.AddMinutes(30) returns "00:30"
> > > >
> > > > DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"
> > > >
> > > > DateTime.Now.AdMinutes(-45)) returns "-00:45"
> > > >
> > > > I've tried all kinds of Format specifiers and nothing is working, any
> > help
> > > > is appreciated.
> > > >
> > > > TIA,
> > > >
> > > > --
> > > > Fritz
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 16 '05 #12
Jay,

Thanks for the help, I'll keep everything DateTime for now. That should
make the grid issue simpler.

Much appreciated.

--
Fritz

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
Fritz,
Neither "String" nor "TimeSpan" support custom formatting. So your elapsed
time will need to be a DateTime. If you make it a DateTime, you can use
"hh:mm" for the format. Note it needs to be lower case, as "MM" is months...
Post if you really need help in how to get the grid to use your formatting.
Hope this helps
Jay
"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:uO*************@tk2msftngp13.phx.gbl...
Jay/Adam,

Not a "homework" assignment, real work. No apologies necessary and I
understand.

The requirement is for a grid control to show an elapsed time formatted in
"hh:mm", with the time in descending order. During development, I need to simulate elapsed time, hence the seeding with the previous times for testing
only.

The confusion is finding the correct formating for "strings", "DateTime"

and
"TimeSpan" and doing the calculations to show the elapsed time in "hh:mm".
The suggestions from both Jay and Adam have very been helpful.

Much appreciated.

--
Fritz
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:OI****************@TK2MSFTNGP12.phx.gbl...
Fritz,
I have to ask, is this a home work assignment? Your questions & troubles make this sounds suspiciously like a home work assignment. If it is I
strongly recommend you stop "cheating", if not, my apologies, proceed.

Thank
you for understanding either way.

It really sounds like you are confusing:
- current time
- entry time
- elapsed time

As Now.AddMinutes(negative) will simulate entry time.

Now will simulate current time.

elapsed time = entry time - current time

It sounds like you want your grid to display elapsed time.

I would consider binding your Grid Control to a custom object, that has
two
properties, as the custom object will allow you to easily update the

elapsed
time value.

This custom object would need an Entry & an Elapsed property. Where
you set
Entry to your Now.AddMinutes(negative), and Elapsed is

Now.Subtract(Entry)

Note DateTime.Subtract will give you a TimeSpan, which you cannot
custom format, if you only want Elapsed to show hours & minutes I would add the TimeSpan to DateTime.MinValue to convert it back to a DateTime...

Alternatively you could bind to a dataset, where you use a timer object and
& for loop to update the elapsed column of each row...

Hope this helps
Jay

"Fritz Switzer" <fr***********@abletfactory.com> wrote in message
news:eA**************@tk2msftngp13.phx.gbl...
> Thanks Jay/Adam,
>
>
> > If your function returns 95, do you literally want "01:35" or do
you want
> > "09:52" (which is Now - 95 minutes).
>
> I want "01:35"
>
> >
> > It sounds like you want "01:35", in which case you do not want to do > > anything with DateTime.Now!
> >
>
> Here are some additional details. I'm simulating a "doctors office", I want
> to display the length in time (in "hh:mm") someone is waiting. I first > start by randomly assigning a time from -(1-120 minutes) so I use
> DateTime.Now.AddMinutes(negative random amount). This then gives me
length
> of time, I'm just using minutes. So patient 1 = 35 minutes, patient 2=
65
> minutes patient 3= 90 minutes . Now I need to display the time in
a grid
> control with the waiting time in "hh:mm" format, and just to make

things
> more complicated also sorted by longest wait time to shortest wait

time.
> So I can get 01:30, 01:05, and 00:35. After two minutes the display
should
> read 01:32, 01:07, 00:37. A timer is updating the display every

minute. >
> hope that clears up things,
>
> Thanks, appreciate the help.
>
> Fritz
>
>
>
>
> > In either case to the time formatted, you need to use
> > DateTime.ToString("hh:mm"), see my first reply for details on
formatting.
>
>
>
>
>
> >
> > Hope this helps
> > Jay
> >
> > "Fritz Switzer" <fr***********@abletfactory.com> wrote in message
> > news:eZ**************@TK2MSFTNGP10.phx.gbl...
> > > Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in
message
> > > news:Of**************@tk2msftngp13.phx.gbl...
> > > > Fritz,
> > > > Can you give a more complete example of what you are doing, and what
> you
> > > > expect?
> > > >
> > >
> > > Thanks Jay, here is more detail.
> > >
> > > I'm using a random function that adds (- minutes) to the current

time.
> > > PickTime returns a negative number between 1-120. When the
value is > > > returned the newTime is okay but just gives me total minutes , I

just
> want
> > > to format the result in hh:mm format. So if 95 minutes is returned
I
> want
> > > newTime to be "01:35" or if 46 is returned "00:46".
> > >
> > > sting newTime =DateTime.Now.AddMinutes(-PickTime()).ToString();
> > >
> > > So in your example:
> > >
> > > > Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
> > >
> > > I'm looking to get 00:45 returned rather than.
> > >
> > > > -45: 7/19/2004 9:52:57 AM
> > >
> > >
> > >
> > > It is being used as a "simulation", the value is attached to a
timertick
> > and
> > > gets updated as time progresses. This seeds a value and the

elapsed time
> > is
> > > updated with each tick, in this case, I'm updating a display
every > minute
> > So
> > > after 20 minutes the display using the above example of -45 I

want the
> > > value to be 01:05 (45+20 minutes or 1 hr 20 minutes)
> > >
> > > hope that helps.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > > As using the following:
> > > >
> > > > Debug.WriteLine(DateTime.Now.AddMinutes(30), "30");
> > > > Debug.WriteLine(DateTime.Now.AddMinutes(90), "90");
> > > > Debug.WriteLine(DateTime.Now.AddMinutes(-45), "-45");
> > > >
> > > > I get:
> > > >
> > > > 30: 7/19/2004 11:07:57 AM
> > > > 90: 7/19/2004 12:07:57 PM
> > > > -45: 7/19/2004 9:52:57 AM
> > > >
> > > > To limit the returned value to HH:MM I would use the ToString

method
> > with
> > > a
> > > > custom format, something like:
> > > >
> > > >
Debug.WriteLine(DateTime.Now.AddMinutes(30).ToStri ng("hh:mm"),
> > > "30")
> > > >
Debug.WriteLine(DateTime.Now.AddMinutes(90).ToStri ng("hh:mm"),
> > > "90")
> > > >
> Debug.WriteLine(DateTime.Now.AddMinutes(-45).ToString("hh:mm"),
> > > > "-45")
> > > >
> > > > 30: 11:10
> > > > 90: 12:10
> > > > -45: 09:55
> > > >
> > > > For details on custom datetime formats see:
> > > >
> > > >
> > >
> >
>

http://msdn.microsoft.com/library/de...matstrings.asp
> > > >
> > > > For information on formatting in .NET in general see:
> > > >
> > >
> >
>

http://msdn.microsoft.com/library/de...ttingtypes.asp
> > > >
> > > > Hope this helps
> > > > Jay
> > > >
> > > >
> > > >
> > > >
> > > > "Fritz Switzer" <fr***********@abletfactory.com> wrote in message > > > > news:u1**************@TK2MSFTNGP10.phx.gbl...
> > > > > I'd like to have a string assigned the value of a
> > > > > DateTime.AddMinutes(amount) so that the string is formatted in > "HH:MM"
> > > > > format.
> > > > >
> > > > > For example:
> > > > >
> > > > > DateTime.Now.AddMinutes(30) returns "00:30"
> > > > >
> > > > > DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"
> > > > >
> > > > > DateTime.Now.AdMinutes(-45)) returns "-00:45"
> > > > >
> > > > > I've tried all kinds of Format specifiers and nothing is

working,
> any
> > > help
> > > > > is appreciated.
> > > > >
> > > > > TIA,
> > > > >
> > > > > --
> > > > > Fritz
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 16 '05 #13
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:eb**************@TK2MSFTNGP10.phx.gbl...
Fritz,
Neither "String" nor "TimeSpan" support custom formatting. So your elapsed
time will need to be a DateTime. If you make it a DateTime, you can use
"hh:mm" for the format. Note it needs to be lower case, as "MM" is months...


Or - you can still use a TimeSpan -

TimeSpan ts = .....
string output = string.Format("%2d:%2d", ts.Hours, ts.Minutes);

That should give the format you want right?
--
Adam Clauss
ca*****@tamu.edu
Nov 16 '05 #14
Adam,
Not if your binding to a grid, unless you want to override the Format &
Parse events.

With all the trouble Fritz appears to be having I don't think its advisable
to push him toward a triathlon...

In other words yes you can do it that way. I just wonder if Fritz should do
it that way.

Just a thought
Jay
"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:eb**************@TK2MSFTNGP10.phx.gbl...
Fritz,
Neither "String" nor "TimeSpan" support custom formatting. So your elapsed time will need to be a DateTime. If you make it a DateTime, you can use
"hh:mm" for the format. Note it needs to be lower case, as "MM" is

months...
Or - you can still use a TimeSpan -

TimeSpan ts = .....
string output = string.Format("%2d:%2d", ts.Hours, ts.Minutes);

That should give the format you want right?
--
Adam Clauss
ca*****@tamu.edu

Nov 16 '05 #15
> With all the trouble Fritz appears to be having I don't think its
advisable
to push him toward a triathlon...
I only particpate in events that last less than an hour. 00:59 :)

--
Fritz

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:eI**************@TK2MSFTNGP09.phx.gbl... Adam,
Not if your binding to a grid, unless you want to override the Format &
Parse events.

With all the trouble Fritz appears to be having I don't think its advisable to push him toward a triathlon...

In other words yes you can do it that way. I just wonder if Fritz should do it that way.

Just a thought
Jay
"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl... Fritz,
Neither "String" nor "TimeSpan" support custom formatting. So your elapsed time will need to be a DateTime. If you make it a DateTime, you can use "hh:mm" for the format. Note it needs to be lower case, as "MM" is

months...

Or - you can still use a TimeSpan -

TimeSpan ts = .....
string output = string.Format("%2d:%2d", ts.Hours, ts.Minutes);

That should give the format you want right?
--
Adam Clauss
ca*****@tamu.edu


Nov 16 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ed | last post by:
Hi there, My problem is the following: When I assign a custom formatted Date & Time to a Date variable it loses it’s formatting. Ex. 2005-06-07 15:46 now when I assign this to a variable of...
6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
1
by: adolf garlic | last post by:
I'm having a problem with dates. (No not the sort that you have at christmas) I have a webform with a text box and a calendar control. You can either - enter a date manually (we are talking uk...
2
by: Roger Twomey | last post by:
I am doing something wrong here but I cannot see it. I have the following lines of code: datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval)...
3
by: t8ntboy | last post by:
I am migrating data from one database to another. The process requires that I significantly modify the table and data structure. Therefore, I am exporting the data to a csv, making the adjustments...
5
by: John B | last post by:
Hi all, Any idea why this code results in a FormatException? DateTime.ParseExact("40708", "dMMyy", CultureInfo.CurrentCulture) If I use "040708" with the same format string it works and it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.