将时间存储在数据库中 [英] Store time in database

查看:166
本文介绍了将时间存储在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅将时间存储为时间(7)或时间

解决方案

Cosider 时间数据类型 [ ^ ]。


如果您想将时间存储为时间跨度。试试这个

 DateTime dt = DateTime.Parse(09:00 PM); 
TimeSpan ts = new TimeSpan(dt.Hour,dt.Minute,dt.Second);


检查这个

在SQL中存储TimeSpan [ ^ ]

Store time only as time(7) or timespan

解决方案

Cosider the time datatype[^].


if you want to store time as timespan. Try This

DateTime dt = DateTime.Parse("09:00 PM");
TimeSpan ts = new TimeSpan(dt.Hour, dt.Minute, dt.Second);


check this
Storing TimeSpan in SQL [^]


这篇关于将时间存储在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆