kejpa Posted January 26, 2004 Posted January 26, 2004 Hi, I'd like to be able to show times over than one day in a textbox. I'd 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? Quote
NK2000 Posted January 26, 2004 Posted January 26, 2004 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 Quote
kejpa Posted January 27, 2004 Author Posted January 27, 2004 As I feared, you'll 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 Quote
onggie80 Posted January 27, 2004 Posted January 27, 2004 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"); Quote
NK2000 Posted January 27, 2004 Posted January 27, 2004 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.