Last post Jul 19, 2018 10:00 AM by PatriceSc
Jul 19, 2018 09:36 AM|TW88|LINK
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.
Jul 19, 2018 10:00 AM|PatriceSc|LINK
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.