Displaying time > 23:59

kejpa

Well-known member
Joined
Oct 10, 2003
Messages
320
Hi,
Id like to be able to show times over than one day in a textbox.
Id like a format that is capable of showing hours and minutes like 99:49 and not like 4d 03:49

Does I have to make this myself or is there a way of using the format function?
 
int hours = DateTime.Now.Day*24 + DateTime.Now.Hour;

string time = String.Format("{0}:{1}", hours, DateTime.Now.Minute);


I hope this is the thing you wanted to know
 
As I feared, youll have to code your own format and you have to do your own checking for valid times :(

It would have been soooo much easier to be able to use the format function, say "hhh:mm" would have resulted in hours and minutes, not limited by the length of the day, "mmm:ss" would have made the same thing giving the number of minutes and seconds not limited by the 60 minutes of an hour.

Thanx anyway.
/Kejpa
 
Not too sure if this is what you are looking for..
but in C# this is what i do to get my datetime to be formatted in a 24-hour clock.

string CurrentTime = DateTime.Now.ToString("HH:mm:ss");
 
Originally posted by onggie80
Not too sure if this is what you are looking for..
but in C# this is what i do to get my datetime to be formatted in a 24-hour clock.

string CurrentTime = DateTime.Now.ToString("HH:mm:ss");

yes but he wants a "over" 24-hour clock, if i am right :)
 
Back
Top