没有从数据库获得毫秒 [英] Not getting milliseconds from database

查看:118
本文介绍了没有从数据库获得毫秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我使用c#调用列表存储过程。这个sp返回一个数据集。数据集hava datetime列中的表。但是在该列值中没有得到毫秒甚至值在数据库中包含毫秒。如何使用毫秒获取数据表。

Hi all,

I am calling a list stored procedure using c#. This sp return a dataset. the Tables in dataset hava datetime columns. But in that column values not getting milliseconds even value contain milliseconds in database. How to get datatable with milliseconds.

推荐答案

在您的应用程序中尝试此代码...



格式(dr [DateValue]。ToString(),dd mmm yyyy hh:nn:ss.fff)获得毫秒



谢谢
try this code in your application...

format(dr["DateValue"].ToString(), "dd mmm yyyy hh:nn:ss.fff") to get milliseconds

Thank you


你可以使用DATEPART()来获取这个例子。



http://www.w3schools.com/sql/func_datepart.asp [ ^ ]
u can use DATEPART() for this..check example for this

http://www.w3schools.com/sql/func_datepart.asp[^]






见下文链接。它可能会帮助您找到解决方案。



http://www.csharp-examples.net/string-format-datetime/ [ ^ ]



谢谢,

Viprat
Hi,

See the below link. It might be help you to find the solution.

http://www.csharp-examples.net/string-format-datetime/[^]

Thanks,
Viprat


这篇关于没有从数据库获得毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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