date() Function in R (Example)
This post explains how to return the current system date and time using the date() function in the R programming language.
The page consists of the following content:
With that, let’s get started.
Example: Get System Date & Time Using date() Function
The code below illustrates how to print the current system date (i.e. weekday, month, day, and year) and time (i.e. hours, minutes, and seconds) to the RStudio console.
For this, we can apply the date function as shown below:
date() # Apply date function # [1] "Wed Oct 13 13:19:44 2021"
As you can see, this tutorial was created on Wednesday, 13th of October 2021, at 1:19:44 pm.
Video, Further Resources & Summary
If you need more information on the R syntax of this article, I recommend watching the following video on my YouTube channel. I show the R programming syntax of this article in the video tutorial:
Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.
If you accept this notice, your choice will be saved and the page will refresh.
Furthermore, you could have a look at the related tutorials on this homepage. I have released several related articles already.
- Sys.Date & Sys.time Functions in R
- Set Time & Date of File & Directory
- System Calls & Commands in R
- R Functions List
- R Programming Tutorials
In this R tutorial you have learned how to use the date() function. If you have additional questions or comments, let me know in the comments. Besides that, don’t forget to subscribe to my email newsletter to receive updates on new tutorials.
Statistics Globe Newsletter