locked
getdate function RRS feed

  • Question

  • I would like to return todays date using the getdate function, the date should be returned in the following format:

    dd/mm/yyyy

    any help is most appreciated.

     

    Sunday, March 28, 2010 6:38 PM

Answers

  • SELECT CONVERT(VARCHAR(10), GETDATE(), 103)

    -- 28/03/2010

    SELECT CONVERT(VARCHAR(10), GETDATE(), 101)

    --03/28/2010

    • Marked as answer by Cire1507 Sunday, March 28, 2010 6:57 PM
    Sunday, March 28, 2010 6:47 PM
  • So , would i be correct in assuming that datestart is a (var)char column which contains , date looking strings?  At least one of those does not translate to a date.  Use the isdate function to find and update / remove / correct it.

    Try Tibors page http://www.karaszi.com/SQLServer/info_datetime.asp for further date related information.


    Dave Ballantyne ---- http://sqlandthelike.blogspot.com
    • Marked as answer by Cire1507 Sunday, March 28, 2010 7:10 PM
    Sunday, March 28, 2010 6:59 PM

All replies

  • SELECT CONVERT(VARCHAR(10), GETDATE(), 103)

    -- 28/03/2010

    SELECT CONVERT(VARCHAR(10), GETDATE(), 101)

    --03/28/2010

    • Marked as answer by Cire1507 Sunday, March 28, 2010 6:57 PM
    Sunday, March 28, 2010 6:47 PM
  • So , would i be correct in assuming that datestart is a (var)char column which contains , date looking strings?  At least one of those does not translate to a date.  Use the isdate function to find and update / remove / correct it.

    Try Tibors page http://www.karaszi.com/SQLServer/info_datetime.asp for further date related information.


    Dave Ballantyne ---- http://sqlandthelike.blogspot.com
    • Marked as answer by Cire1507 Sunday, March 28, 2010 7:10 PM
    Sunday, March 28, 2010 6:59 PM