Home > Database > Mysql Tutorial > body text

SQL Server使用convert对datetime日期数据进行获取

WBOY
Release: 2016-06-07 17:42:40
Original
1049 people have browsed it

以下的文章主要描述的是SQL Server使用convert取得datetime日期数据的实际操作流程,在实际操作中用SQL Server数据库中用convert来获取datetime日期数据,以下实例包含各种日期格式的转换。 语句及查询结果: SelectCONVERT(varchar(100),GETDATE(),0):05162

以下的文章主要描述的是SQL Server使用convert取得datetime日期数据的实际操作流程,在实际操作中用SQL Server数据库中用convert来获取datetime日期数据,香港服务器,以下实例包含各种日期格式的转换。

 

语句及查询结果:

 

 

  • Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM  
  • Select CONVERT(varchar(100), GETDATE(), 1): 05/16/0 
  •  

    SQL Server使用convert来取得datetime日期数据,香港虚拟主机,以下实例包含各种日期格式的转换

     

    语句及查询结果:

     

    说明:

    SQL Server使用convert:

  • CONVERT ( data_type [ ( length ) ] , expression [ , style ] ) 
  • 参数

    expression

     

    是任何有效的 Microsoft® SQL Server™ 表达式。。

    data_type

    目标系统所提供的数据类型,包括 bigint 和 sql_variant。不能使用用户定义的数据类型。

    length

     

    nchar、nvarchar、char、varchar、binary 或 varbinary 数据类型的可选参数。

    style

    日期格式样式,借以将 datetime 或 smalldatetime 数据转换为字符数据(nchar、nvarchar、char、varchar、nchar 或 nvarchar 数据类型);或者字符串格式样式,借以将 float、real、money 或 smallmoney 数据转换为字符数据(nchar、nvarchar、char、varchar、nchar 或 nvarchar 数据类型)。

    ,服务器空间
    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!