UDF for BOTH Date & Time

  • "Minimal thinking effort is always useful in programming"

    My theory goes:

    The entire human progress was driven by the lazy ones.

    The whole objective of the progress is to have more with doing less.

    ---------------------------------------------
    [font="Verdana"]Nothing is impossible.
    It is just a matter of time and money.[/font]

  • Jeff,

    Is this why we pay so much for the phone service?

    So they can pay you big bucks to write functions like this?

    ---------------------------------------------
    [font="Verdana"]Nothing is impossible.
    It is just a matter of time and money.[/font]

  • Absolutely agree.

    They were thinking instead of digging.

    You can still type all those dates on a typewriter (if you can find one ), but you (and me) are too lazy to do it. So you need to think how to teach machine to do your job while you're wasting company's time on this forum.

    _____________
    Code for TallyGenerator

  • Heh... no... they only paid me the big bucks to round UP your minutes

    --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)

  • They actually pay someone else to round down your minutes.

    It's you who suppose to place right function on back end to round it up.

    _____________
    Code for TallyGenerator

  • "Precisely"

    --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)

  • OK:

    ....Could be that I am missing something:

    In SQL QUERY ANALYZER, when I run:

    PRINT CONVERT(DateTime, GetDate(), 20) OR

    PRINT CONVERT(DateTime, GetDate(), 120)

    I get:

    Jun 14 2007 9:26AM

    So the formatt: YYYY-MM-DD HH:MM:SS did not take.

    ... any further leads?

    Anthony

  • PRINT CONVERT(VARCHAR, GetDate(), 20)

    PRINT CONVERT(VARCHAR, GetDate(), 120)

    In your example you just converted from datatime to datetime (so the format just got ingnored - or maybe even the conversion) and the QA used the default setting to display the date

     

    ---------------------------------------------
    [font="Verdana"]Nothing is impossible.
    It is just a matter of time and money.[/font]

  • The PRINT statement just performed an implicit conversion of your nicely converted datetime to varchar

    --------------------
    Colt 45 - the original point and click interface

Viewing 9 posts - 16 through 23 (of 23 total)

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