By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,458 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,458 IT Pros & Developers. It's quick & easy.

messing with Time

P: n/a
What will be the best class for time representation?

i need simple interaction ( convert string to time , get time ...)

format time : "08:00" "22:09"

is DataTime the best class for me ?

should I write my own Code ?

Thank you

Sharon
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Use DateTime, although it is not a class but a struct. You need not worry
about the date portion if all you care about is the time, but it will be
there none the less. The reason to use this is that it is more easily
transmitted to/from a database such as SQL Server rather than rolling your
own class.

JIM
"Sharon" <Sh*******@hotmail.com> wrote in message
news:uE**************@TK2MSFTNGP09.phx.gbl...
What will be the best class for time representation?

i need simple interaction ( convert string to time , get time ...)

format time : "08:00" "22:09"

is DataTime the best class for me ?

should I write my own Code ?

Thank you

Sharon

Nov 16 '05 #2

P: n/a
It's almost always best to go with something already written, debugged
*and* standardized, rather than trying the write & debug your own
proprietary solution.

The only trick with using DateTime is to remember to filter out the date
portion when you output the time:

DateTime dt = DateTime.Parse("08:00");
Console.WriteLine("{0:t}", dt);

Displays: "8:00 AM"

"Sharon" <Sh*******@hotmail.com> wrote in message
news:uE**************@TK2MSFTNGP09.phx.gbl...
What will be the best class for time representation?

i need simple interaction ( convert string to time , get time ...)

format time : "08:00" "22:09"

is DataTime the best class for me ?

should I write my own Code ?

Thank you

Sharon

Nov 16 '05 #3

P: n/a
Or just use DateTime.ToLongTimeString()

DalePres

"James Curran" <ja*********@mvps.org> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...
It's almost always best to go with something already written, debugged
*and* standardized, rather than trying the write & debug your own
proprietary solution.

The only trick with using DateTime is to remember to filter out the
date
portion when you output the time:

DateTime dt = DateTime.Parse("08:00");
Console.WriteLine("{0:t}", dt);

Displays: "8:00 AM"

"Sharon" <Sh*******@hotmail.com> wrote in message
news:uE**************@TK2MSFTNGP09.phx.gbl...
What will be the best class for time representation?

i need simple interaction ( convert string to time , get time ...)

format time : "08:00" "22:09"

is DataTime the best class for me ?

should I write my own Code ?

Thank you

Sharon


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.