Innova
Innova

Reputation: 4971

How to get the Time value from datetime picker

How to get the time value in a stored procedure from a DateTimePicker value?

For Example:
I have a datetime picker value stored into my table as:

'2010-04-06 09:00:00.000' 
'2010-04-07 14:30:00.000'

But it show the values as 9:00 or 14:30

I need it to show them as 9:00AM and 2:30PM instead of 14:30.

Upvotes: 0

Views: 9698

Answers (3)

Hun1Ahpu
Hun1Ahpu

Reputation: 3355

You can use yourDate.ToString("t");.
Also check other formats

Upvotes: 2

user2842011
user2842011

Reputation: 1

to get current time you can use

now.toshorttime()

Upvotes: 0

darja
darja

Reputation: 5025

try something like that:

date.ToString("hh:mm tt", CultureInfo.InvariantCulture);

Upvotes: 0

Related Questions