Automate same day R code

This post was flagged by the community and is temporarily hidden.

Do you mean something like this?

format(Sys.time(), '%m/%d/%y')

Hi, you can use Sys.Date() it returns the system date with the same format you're using there.

So I would update to this?

mutate(date = as.Date(Sys.Date(), "%m/%d/%y"))

No, I don't think so. if you do that you will only change the value of the data returned by the query, and you will end up having the current date but results for an other date.

I think you should apply the change in this line:

where DATE(SUBSTR(k.TXTSENTTS,1,10)) >= '2020-11-18'

and replace the static date to be:

where DATE(SUBSTR(k.TXTSENTTS,1,10)) >= Sys.Date())

or maybe use equal "=" instead of ">=", depending on the results you want.

Hi that didn't seem to work. I got this error.


Is there any other way to do it?

Hi, I no longer can see the original post. However, you can print the query in the console first, then test it directly on the database system to make sure it's working.