Formatting a date in a stored procedure

  • Yep, you're right on the setting of the variable... but hopefully every one realizes that was just to demo.  The rest shouldn't be a problem as I used fixed formats that are supposed to be language independent.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I'm sure there's no doubt about it being a demo.

    I was just taking the opportunity to plug for ambigous vs nonambigous dateformats.

    There's questions and confusion almost daily about dates, and the common factor is that most people are using an ambigous format. (eg like the us style 01/02/03 - or was that the british..? )

    I know that most people say that 'it works here' etc, however we're moving in a global world on a daily basis these days, so these small things becomes more and more important. These forums is a good example of a place where you have no idea of the readers native language, or default calendar style. Thus it makes sense for all to try to adapt a 'foolproof', non language and non datesetting dependant format when writing out dates without the additional information on which style it represents. (like yyyymmdd)

    ...and it's not aimed at you personally, it's for us all to think about

    /Kenneth

  • Nope... not a problem... I knew it wasn't personal... you're right about the daily date questions and the "mistrakes" folks make doing things on a global basis.  Shoot, I still have guys that don't understand that you don't store date formats in DATETIME datatypes

    I am starting to think that the world should standardize on a numeric format... star dates or date serials would be cool except someone would figure out a way to use Roman Numerals or something   Just think of the business we could drum up replacing all the clock faces in the world

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 16 through 17 (of 17 total)

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