在sql server中需要提供哪种数据类型进行保存(17-03-2014 13:09 PM) [英] In which datatype need to give in sql server for saving (17-03-2014 13:09 PM)
本文介绍了在sql server中需要提供哪种数据类型进行保存(17-03-2014 13:09 PM)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hai
我将使用此行获取当前日期,上午或下午的时间
Hai
I will get current date,time with AM or PM using this line
Dim todaysdate As String = String.Format("{0:dd-MM-yyyy HH:mm tt}", DateTime.Now)
我得到的这个17-03-2014 13 :09 PM
那么在sql server中需要为字段提供什么数据类型?
and i get this 17-03-2014 13:09 PM
So what datatype need to give for field in sql server ?
推荐答案
datetime [ ^ ]。
请参阅:http://www.sql-server-helper.com/tips/date-formats.aspx [ ^ ]获取日期的不同版本。
-KR
datetime[^].
See this : http://www.sql-server-helper.com/tips/date-formats.aspx[^] for getting the different versions for the date.
-KR
我建议你使用DateTimePicker控件,它为用户提供了一种方便的方式来进行日期/时间选择而无需日期格式验证的麻烦。它在DateTimePicker中有一个名为Value的属性。该值直接返回包含DateTimePicker值的DateTime对象。然后,您可以将此值插入/更新到数据库表的日期时间字段中。
每个数据片段应尽可能创建并保留其原生类型,而不会进行不必要的转换。
阅读: vb.net_date_time_picker [ ^ ]
I suggest you use the DateTimePicker control which offers a convenient way for users to make a date/time selection without the hassle of date format validation. It has a property named Value in the DateTimePicker. The value directly returns a DateTime object containing the value of the DateTimePicker. You can then insert/update this value into a datetime field of a database table.
Every piece of data should be created in and stay with its native type as much as possible without unnecessary conversions.
Read about: vb.net_date_time_picker[^]
这篇关于在sql server中需要提供哪种数据类型进行保存(17-03-2014 13:09 PM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文