Stripping Times from T-SQL Dates

When you’re writing queries in Salesforce Marketing Cloud sometimes it’s helpful to truncate the time from date columns — like when you want to compare two date columns, one with a time and one without. You can strip the time off of both to make sure you’re comparing apples to apples.

Here’s an example:

The first column returns the full date and time, the second column cast strips the time portion.

date with timedate without time
2013-04-04 14:37:39.3632013-04-04 00:00:00.000

For further reading:

(Visited 83 times, 1 visits today)
Notify of
Inline Feedbacks
View all comments