how to set format in date function in sql ?
  • my date has in sql this format 20140402 i want to get this format 2014-04-02 what should i do please help me
  • 5 Comments sorted by
  • hi arshad try this below query 

    declare @DateString varchar(10)
    set @DateString='20140402'

    select SUBSTRING(@DateString,0,5) +'-'+SUBSTRING(@DateString,5,2)+'-'+SUBSTRING(@DateString,7,2)

    you can change variable to your column name.
  • how should i put sql colunm
  • thanks bro :)
  • use this query

    SELECT ProductName, Price, FORMAT(Now(),'YYYY-MM-DD') AS PerDate
    FROM Products;
  • select CONVERT(date,CreatedDate) as CreatedDate from IMEIMaster 

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week