Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Buenos Aires, Argentina
    Posts
    20

    Question Unanswered: Date Format 'MM/YYYY'

    Hi:

    I need to format a date like this:

    01/2004 -> 'MM/YYYY'

    I know that I can do this....


    SELECT CAST(datepart(mm,getdate()) AS VARCHAR) + '/' + CAST(datepart(yyyy,getdate()) AS VARCHAR)

    but , Is there is another better solution?
    ------------------------------------
    Thanx
    ------------------------------------
    http://www.iespana.es/greatavatar/FIRMA/firma.jpg

  2. #2
    Join Date
    Sep 2003
    Location
    Dallas, Texas
    Posts
    311

    Re: Date Format 'MM/YYYY'

    select right(convert(char(10), getdate(), 103), 7)

  3. #3
    Join Date
    Oct 2003
    Location
    Buenos Aires, Argentina
    Posts
    20

    Re: Date Format 'MM/YYYY'

    Originally posted by joejcheng
    select right(convert(char(10), getdate(), 103), 7)
    Thanx a lot .
    You save my life !!
    ------------------------------------
    Thanx
    ------------------------------------
    http://www.iespana.es/greatavatar/FIRMA/firma.jpg

Posting Permissions

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