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

    Unanswered: Explicit DATE FORMAT

    Hi:

    How can I force MsSQL to a explicit DateFormat.
    Like: 'DD/YY'
    ------------------------------------
    Thanx
    ------------------------------------
    http://www.iespana.es/greatavatar/FIRMA/firma.jpg

  2. #2
    Join Date
    Dec 2003
    Posts
    454
    SELECT CAST(Day(getdate()) AS char(2)) + '/' + CAST(RIGHT(Year(getdate()), 2) AS char(2))

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    First, you can't control they way date is stored, because it's in 2 integer format, no matter what you do. It's the output format you're talking about. And this one depends on connection and environment setting of the client. If you're talking about QA, go to Optins and enable Use Regional settings..., then go to your Regional Settings applet in Control Panel and set it the way you want.

  4. #4
    Join Date
    Oct 2003
    Location
    Buenos Aires, Argentina
    Posts
    20
    Because I'm "converting" PL/SQL sentencies to TSQL I was making a "traslation".

    As you may know ORACLE has this:

    TO_DATE('29/01/2003', 'DD/MM/YYYY')

    and I thought that MSSQL had something like that.

    Thanks for your response.
    ------------------------------------
    Thanx
    ------------------------------------
    http://www.iespana.es/greatavatar/FIRMA/firma.jpg

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    'DD/YY'???

    What good does that date format do?

    rdjabarov is correct, but if you insist on formatting this in your SQL code then look up the CONVERT function in Books Online.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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