Forum Discussion
SQL Query Translation - DateTrunc
- 7 years ago
Hi Anonymous
If you want to convert the following code to SQL code,
DateTime BETWEEN AddMonth(-1,DateTrunc('month', GETUTCDATE())) AND DateTrunc('month', GETUTCDATE())
You could try the following SQL in SQL Server
BETWEEN DATEADD(MONTH,DATEDIFF(month, 0,GETUTCDATE() )-1,0) AND DATEADD(month, DATEDIFF(month, 0,GETUTCDATE() ), 0)
Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
If you want to convert the following code to SQL code,
DateTime BETWEEN AddMonth(-1,DateTrunc('month', GETUTCDATE())) AND DateTrunc('month', GETUTCDATE())
You could try the following SQL in SQL Server
BETWEEN DATEADD(MONTH,DATEDIFF(month, 0,GETUTCDATE() )-1,0) AND DATEADD(month, DATEDIFF(month, 0,GETUTCDATE() ), 0)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous7 years agoNot applicable
PERFECT! Thanks!