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)'

     
  • 相关阅读:
    ◆ C++中通过溢出覆盖虚函数指针列表执行代码
    关于在OnTimer中连续弹出对话框的讨论
    SetTimer
    Windows内核对象
    日志收缩
    暴力求值
    低级问题
    函数限制
    字符串找字段和表
    android错误提示说明汇总
  • 原文地址:https://www.cnblogs.com/jungil/p/10606334.html
Copyright © 2011-2022 走看看