在SQL Server(datetime类型)中存储datetime时,它存储在哪个格式? [英] When storing a datetime in sql server (datetime type), what format does it store it in?

查看:274
本文介绍了在SQL Server(datetime类型)中存储datetime时,它存储在哪个格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在sql server 2008中存储datetime值时,使用datetime类型,它将以什么格式存储值?

When storing a datetime value in sql server 2008, using the datetime type, what format will it store the value in?

是自1970年以来的秒数(或任何)?

Is it the number of seconds since 1970 (or whatever)?

在应用程序端(.net),我传递一个datetime对象。

On the application side (.net), I am passing in a datetime object.

当我查看查询分析器中的表行时,是否会根据我的文化设置进行格式化,或者我正在查看数据库中存储的内容?

When I view the table's rows in query analyzer, will it format it according to my culture settings or am I viewing exactly what is stored in the db?

推荐答案

在内部,根据SQLDenis,它们存储为两个整数

http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-are-dates -stored-in-sql-server

Internally, according to SQLDenis, they are stored as two integers
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-are-dates-stored-in-sql-server

当您在查询分析器中查看它们时,您将看到评估数字。

When you view them in the query analyzer you are seeing evaluated numbers.

存储为unix time

http://en.wikipedia.org/wiki/Unix_time

It is not stored as "unix time"
http://en.wikipedia.org/wiki/Unix_time

这篇关于在SQL Server(datetime类型)中存储datetime时,它存储在哪个格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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