开发者

How to format the DateTimePicker into hh:mm:ss and What is the appropriate type to save time in mysql?

I want to save the time in the format hh:mm:ss from the DateTimePicker to MySQL database, How to format the DateTimePicker into hh:mm:ss only without date and What is the appropriate type to s开发者_如何学编程ave time in mysql?

Regards & Thanks,

Putri Diana


You can format it to show time by

dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "hh:mm:ss";
dateTimePicker1.ShowUpDown = true;

Get the value into a Timespan object in this way for processing in your code

TimeSpan ts1 = TimeSpan.Parse(dateTimePicker1.Text);

I think MySql has got a Time Datatype you could use that (Ahh Got this here)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜