• I think sometime, thorough reading is required to see the ideas.

    "I am not pretending to get the best solutions - the article just shows some WAYS of datatime data type usage. It is like to say that the person who shows how engine is working is not presenting the best engine design. This is not the purpose of the article."

    Here are some examples of using datetime data type. A transaction/modification very often requires some unique identifier. In light-load transactional systems (1-2 transactions per second) you can produce a unique id based on the timing characteristics of the transaction itself. I use this method for years and have no problems.”

    And this method used by company for 4 years and has no issues in our environment.

     

    “I agree with AlexP about using CONVERT when possible. For example CONVERT(CHAR(10), GETDATE(), 101) will return mm/dd/yyyy and strip off the time.”

    Please check the variety of formats and let me know if CONVERT function can provide me with '23FEB04'  , '20040223154524', or only seconds and milliseconds ‘23005’. And this is the set of formats our company has to deal with. Our apps/users required 10-12 strange formats that are not the formats of CONVERT or any other Microsoft functions. And this function provides universal set of formats for all applications. I set only 6 as example. Some of them are presented with CONVERT function.

    -- @dateformat = 1 Format:  '05-SEP-2003'
    -- @dateformat = 2 Format:  '05SEP2003'
    -- @dateformat = 3 Format:  '15-Sep-2003 15:23:23'- dd-mon-yyyy hours:minutes:sec
    -- @dateformat = 4 Format:  '23FEB04'
    -- @dateformat = 5 Format:  '20040223154524'  -- yyyymmddhhmiss
    -- @dateformat =6 Format:  '03-Mar-2004 10:11 PM'   dd-mmm-yyyy hh:nn am/pm
    --***********************************************************

    The next function has been developed to determine previous, closest, or next date from the given date.

    Please let me know about Microsoft created function with above functionalities. If we are talking about implementation then this is different case. Implementation can be done many ways.