In SQL date format this would appear as something like 0000:01:14 10:03:00 This is taking the number of whole days since time began which was calculated in Part 1 and adding this to the beginning of time (0).Īs an example let’s say it’s 10.03 on the 14 Jan in Year 0. What this is doing is finding the number of whole days (without time) from the beginning of time (0) to the date you want to remove the time (DateToRemoveTime). I’ll explain how this works as it was quite confusing initially. Remove the time from a SQL datetime using a formulaĭATEADD(dd,0,DATEDIFF(dd,0,DateToRemoveTime)) The second way is to change the data type. One way to remove the time is with a formula. Two ways to remove the time from a datetime in SQL I am deliberately ignoring ways to do this using TEXT functions – these are slow and to be avoided for this type of task. There are a few ways to remove the time from a datetime in SQL.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |