Microsoft SQL Module UTC offset

Using make.com’s SQL module to Execute a Query (advanced), I can’t seem to find a way to only return a date (not datetime)

Using the query SELECT CAST(GETDATE() AS DATE); returns Bundle 1 as October 15, 2023 7:00PM. I am in central time, so the -5 UTC offset is correct, but I don’t want the time at all. I just wanted it to return today’s date October 16, 2023.

image

That same query ran in SQL’s SSMS returns just the date as expected.

Interestingly, the output bundle looks like below, but i would have expected it just to be “2023-10-16” with no time component.

[
{
“”: “2023-10-16T00:00:00.000Z”
}
]

Does the make.com SQL module support datatype of Date?

Welcome to the Make community!

Have you tried the SQL function DATEFROMPARTS?

an example is provided on this Stack Overflow answer by nzrytmn: How to select date without time in SQL

I would use DATEFROMPARTS function. It is quite easy and you don’t need casting. As an example this query :

Select  DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), DAY(GETDATE())) as myNewDate

will return

2021-01-21

The good part you can also create you own date, for example you want first day of a month as a date, than you can just use like below:

Select  DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), 1) as myNewDate

The result will be:

2021-01-01

2 Likes

Thank you for the very quick response! Unfortunately, your solution seems to provide the same output as every other solution I’ve tried.

image

Oooh I think I know what’s going on now. Make is auto-converting that into a Date type.

When you’re mapping it in another module, simply use the formatDate() function to convert it into a string using the Date Format Tokens.

2 Likes