problem with converting a number to time format

getnitha

Member
Joined
Jul 16, 2007
Messages
14
Programming Experience
1-3
hi

I am trying to convert a number,say 8 to time format,say 08:00:00.
how to do this.
can anyone help me
 
you assert that a number like 8 is the number of hours? since when?

8 is a timespan, not a date. If youre after a quick and nasty way to turn 8 into a time:

DateTime.Date.AddHours(8).ToShortTimeString()

This takes todays date at midnight, adds 8 hours, and pulls the time as a string. Dont even try to compare it to another date.. For example 9 yesterday is actually before 8 today..
 
Back
Top