Results 1 to 4 of 4

Thread: get datetime

  1. #1
    Join Date
    Jul 2004
    Posts
    61

    Unanswered: get datetime

    Hi All,

    How can I get datetime (getdate() function) in format 'yyyy-mm-dd hh:mi:ss'?
    Please tell me.

    Thanks
    Thi Nguyen

  2. #2
    Join Date
    Jan 2004
    Location
    Shanghai,China
    Posts
    76
    1> select convert(varchar(4),datepart(year,getdate()))+'-'+convert(varchar(2),tepart(month,getdate()))+'-'+convert(varchar(2),datepart(day,getdate()))+' '+convert(varchar(10),getdate(),108)
    2> go
    Last edited by enhydraboy; 08-16-04 at 04:24.

  3. #3
    Join Date
    Apr 2004
    Posts
    7
    1> select convert(char(10), getdate(), 111) + ' ' + convert(char(8), getdate(), 108)

    2> go

    the ouput is:

    2004/08/16 11:18:14
    yyyy/mm/dd hh:mi:ss

  4. #4
    Join Date
    Jul 2004
    Posts
    61
    Thanks everyone
    It's useful
    Thi Nguyen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •