zoukankan      html  css  js  c++  java
  • [SQL]convert string to date

    Declare @d datetime

    select @d = getdate()

    select @d as OriginalDate,

    convert(varchar,@d,100) as ConvertedDate,

    100 as FormatValue,

    'mon dd yyyy hh:miAM (or PM)' as OutputFormat

    union all

    select @d,convert(varchar,@d,101),101,'mm/dd/yy'

    union all

    select @d,convert(varchar,@d,102),102,'yy.mm.dd'

    union all

    select @d,convert(varchar,@d,103),103,'dd/mm/yy'

    union all

    select @d,convert(varchar,@d,104),104,'dd.mm.yy'

    union all

    select @d,convert(varchar,@d,105),105,'dd-mm-yy'

    union all

    select @d,convert(varchar,@d,106),106,'dd mon yy'

    union all

    select @d,convert(varchar,@d,107),107,'Mon dd, yy'

    union all

    select @d,convert(varchar,@d,108),108,'hh:mm:ss'

    union all

    select @d,convert(varchar,@d,109),109,'mon dd yyyy hh:mi:ss:mmmAM (or PM)'

    union all

    select @d,convert(varchar,@d,110),110,'mm-dd-yy'

    union all

    select @d,convert(varchar,@d,111),111,'yy/mm/dd'

    union all

    select @d,convert(varchar,@d,12),12,'yymmdd'

    union all

    select @d,convert(varchar,@d,112),112,'yyyymmdd'

    union all

    select @d,convert(varchar,@d,113),113,'dd mon yyyy hh:mm:ss:mmm(24h)'

    union all

    select @d,convert(varchar,@d,114),114,'hh:mi:ss:mmm(24h)'

    union all

    select @d,convert(varchar,@d,120),120,'yyyy-mm-dd hh:mi:ss(24h)'

    union all

    select @d,convert(varchar,@d,121),121,'yyyy-mm-dd hh:mi:ss.mmm(24h)'

    union all

    select @d,convert(varchar,@d,126),126,'yyyy-mm-dd Thh:mm:ss:mmm(no spaces)'

     
  • 相关阅读:
    Go 接口
    Go 参数传递
    Go 结构体
    Go 指针
    使用ContentType处理大量的外键关系
    django的render的特殊用法
    restframework中的那些参数你知道吗?
    scrapy框架
    numpy如何使用
    HTML 5 audio标签
  • 原文地址:https://www.cnblogs.com/jungil/p/10606334.html
Copyright © 2011-2022 走看看