在c#中截断的milisecond [英] Milisecond truncated in c#

查看:159
本文介绍了在c#中截断的milisecond的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有datetime字段,价值是



2013-09-04 16:30:44.000



当我在c#中获取此值时使用



dataadapter.fill(datatable)



它返回2013-09-04 16:30:44并截断毫秒。



任何解决方案?

I have datetime field in database and Value is

2013-09-04 16:30:44.000

when i fetch this value in c# by using

dataadapter.fill(datatable)

it returns 2013-09-04 16:30:44 and truncate milisecond .

Any solution?

推荐答案

这可能不是问题; 16:30:44和16:30:44.000是相同的值。



使用小数部分不为零的值进行测试可能很有用(例如: 16:30:44.389)看看会发生什么。



也许你应该在代码中强制显示毫秒来查看你得到的确切值。



如果没有任何给定的代码,就无法诊断真正的问题(价值问题或格式问题)。
It may not be an issue ; 16:30:44 and 16:30:44.000 are the same value.

It could be useful to test with a value whose decimal part is not zero (eg: 16:30:44.389) and see what happens.

Maybe you should force the display of milliseconds in your code to see the exact value you get.

Without any given code, it's impossible to diagnose the real issue (a value issue, or a formatting issue).


检查数据类型你用来存储那个价值。阅读说明。确保它确实存储了几分之一秒。然后确保在检查或输出值时,确实显示完整值而不跳过分数,或者意外地将其转换为 int ,从而丢失分数。 />


如果您需要更具体的建议,请向我们展示您用于读取,存储,检索和显示日期值的代码。具体包括数据类型以及移动或修改值的任何代码。
Check the data types you are using to store that value. Read the description. Make sure it does store fractions of a second. Then make sure when you check or output the value, that you do display the full value and not skip the fraction, or accidentally convert it to int, losing the fraction.

If you want more specific advice, show us the code you use to read, store, retrieve, and display the date value. Specifically include the data types and any code that moves or modifies the value.


这篇关于在c#中截断的milisecond的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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