COnverting GetDate()

  • I would like to convert/cast GETDATE() into a string but keep the format YYYY-MM-DD.

    If I use a CAST(getdate() as varchar(50) I get July 3 2009

    Need Assistance PLease.

  • What you really need to do is lookup CONVERT in BOL (Books Online, the SQL Server Help System that you can access from SSMS by pressing the {f1} function key).

    Here is what you are looking for:

    select convert(char(10), getdate(), 120)

  • thank you

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply