How to detect date field = 1900/x/x RRS feed

  • Question

  • User363578564 posted

    How to detect date field = 1900/x/x?

    The date formats are different by date format in servers.

    it would be problem if fixed format, like this in asp.net

    ABC.ToString.Replace("0:00:00", "").ToString.Replace("1/1/1900", "")

    any better way in sql or asp.net side?  Thanks a lot.

    Thursday, July 19, 2018 9:36 AM

All replies

  • User753101303 posted


    ABC is a DateTime value ? Always try to work on native values rather than on string ie testing ABC against new Date(1900,1,1) should always work.

    The purpose of a string should be just to show the value to the user and accept user input. All processing should be done on actual date/time values so that you don't have to care about which convention was used to format the string.

    Thursday, July 19, 2018 10:00 AM