Showing results for 
Search instead for 
Did you mean: 
Community Team Member
Community Team Member
Often times, we want to analyze data with the date from yesterday. How do we auto-populate yesterday's date? There are a few formats that we can use!
The syntax below lets us get yesterday's date with timestamp:
select dateadd(day,-1,getdate()) 
To only get yesterday's date at 00:00:00: 
select dateadd(day,-1,trunc(getdate()))
If you wish to get the date and ditch the timestamp completely, you can use the SQL formatter!
select  [dateadd(day,-1,getdate()):date]
You can also use the interval syntax for a more elegant code:
select [getdate():date] - interval '1 day'
Version history
Last update:
‎03-02-2023 09:38 AM
Updated by:
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: