tags:

views:

34

answers:

2

Hi, i am using linq to fetch the data and converting time field into string.

At that time if i have a value 11:00:00 in time field of sql server.

But i am getting "Jan 1 1900 11:00AM" at the time of converting to string.

Please provide me help to fetch only time part.

Thanks in advance..

+1  A: 

Try this:

yourDateTimeObject.ToString("HH:mm:ss")

Or as Mark Seemann suggested:

yourDateTimeObject.TimeOfDay.ToString()
Yannick M.
+1  A: 

It sounds like the field is of type DateTime. You can use the TimeOfDay property to get only the time part.

timeField.TimeOfDay
Mark Seemann