Problems using a date literal in a calculated field

The Create calculation and rollup properties page describes four types of literals: strings, numbers, booleans, and dates:

When I try to use a date literal in a date function, however, it’s read as a number:

How are you supposed to use date literals? if I enclose it in quotes it’s read as a string. Brakets, braces, and parenthesis also don’t work. Is there a keyword to identify it as a date literal? what am I missing?
Thanks

Hi @PTancredi,

If the formula is expecting a strung, have you tried the number to string function? Create calculation and rollup properties

I can’t make sense if it logically but it’s worth a try.

Best regards

Thanks. Seems not :

@PTancredi which output format have you currently selected? Can you please share a screenshot of the entire property configuration?

You and @BBaber were correct. I’m actually trying to create a date string and was just testing the time_between function because there’s no day() function. Trying in a new field with the output set to nubmer worked. Now I just have to translate milliseconds into days:
Thank you!!

@PTancredi glad we could help!

also, HubSpot just came out with some updates to calculation properties that rely on today()

check it out and see if it helps :slightly_smiling_face:

https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com/properties/use-todays-date-in-the-crm&hubs_content-cta=create%20time%20since%20and%20time%20until%20calculation%20properties#create-time-since-or-time-until-calculation-properties

That’s useful! but unfortunatley that article says they’re not available as inputs in calculations and rollup properties.

Basically I was trying to overcome the lack of a day([date]) function and needed a fixed date for comparisson, and date literals are the only way to get a fixed date. If there were a date constructor (like date()) I could use that but there isn’t. Ultimately using the date literal allowed me to calculate day of the month (with a big, complex, script)

You need to change your output type from string to number.
What are you expecting the result of your formula to be if, for example, Course Start Date is today?

The calculated property UI controls the output type based on the function. You can see that it’s already Number in the upper right of my original screenshot.
My question is how to reference a date literal as described above in a date formula in a calculated property, which shouldn’t be confused with a formula field.

Appoligies - I can change the output type - Thank you!!