Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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

Posted

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

Posted

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");

Posted
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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...