RStudio snippets are very handy when it comes to dealing with repetitive tasks. Here is how to modify RStudio snippets or create a new one.
In my case, there was a problem with the format that I get by using the ts snippet.
Modify RStudio snippets
To change or create new snippet go to Tools -> Global Options -> Code -> Edit Snippets.
After that, I located the ts snippet.
To get my desired date-time format, I replaced the date function with this and saved snippets.
format(Sys.time(), format = "%Y-%m-%d %H:%M:%S")
You can enhance productivity in RStudio by making RProfile modifications. Take a look at this post on how to do that and why.