i am storing dates as datetime, so let us say the date is 2004-07-15 11:42:43.780. Now i want to retrieve it exactly like this. Unfortunately it doesnot come out like this.
It is coming out like this Jul 15 2004 11:44AM and i'm losing the seconds
Could anyone please advise me how to get 2004-07-15 11:42:43.780.
Thanks in advance.
MS-SQL doesn't distinguish between date and time, there is a single datatype that is DATETIME (and a sub-set of it that is SMALLDATETIME). You can truncate the value to either a date or a time to make computation easier, but you can't truly isolate the date from the time. Try using: