via likecool
Days between T-SQL Dates
Suppose you’d like to select subscribers from an Salesforce Marketing Cloud data extension that were created in the last thirty days. Here’s what I use:
or between two static dates:
For further reading:
Patton Oswalt’s Star Wars Filibuster
Patton Oswalt’s Star Wars Filibuster on Parks and Recreation. This is so epic.
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 time | date without time |
|---|---|
| 2013-04-04 14:37:39.363 | 2013-04-04 00:00:00.000 |
For further reading: