Sys.Date & Sys.time Functions in R (2 Examples) | Current Date & Time
In this R tutorial you’ll learn how to return the system date and time using the Sys.Date and Sys.time functions.
The article will consist of these contents:
Let’s take a look at some R codes in action…
Example 1: Get Current Date Using Sys.Date() Function
Example 1 explains how to extract the current system date in R.
For this task, we can apply the Sys.Date function as shown below:
Sys.Date() # Apply Sys.Date function # [1] "2021-10-11"
As you can see, the current date when creating this tutorial is the 11th of October 2021.
Example 2: Get Current Time Using Sys.time() Function
This example shows how to return the system time using the Sys.time command.
Consider the following R code and the corresponding output of the RStudio console:
Sys.time() # Apply Sys.time function # [1] "2021-10-11 15:16:51 UTC"
At the point when I was creating the tutorial, it was almost 3:17 pm.
Video, Further Resources & Summary
Have a look at the following video on my YouTube channel. I demonstrate the R syntax of this page in the video.
The YouTube video will be added soon.
In addition, you could have a look at the other tutorials on my homepage:
- Sys.timezone Function in R
- Get List of Known Time Zones
- Change Default Time Zone in R
- Introduction to System Calls & Commands
- Useful Commands in R
- R Programming Language
You have learned in this tutorial how to apply the Sys.Date and Sys.time functions in the R programming language. Please let me know in the comments, in case you have any further questions.
Subscribe to the Statistics Globe Newsletter
Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.
Thank you!
Welcome to the Statistics Globe newsletter. From now on, I’ll send you regular emails about statistics, data science, AI, and programming with R and Python.
I’m Joachim Schork. On this website, I provide statistics tutorials as well as code in Python and R programming.
Statistics Globe Newsletter
Get regular updates on the latest tutorials, offers & news at Statistics Globe. I hate spam & you may opt out anytime: Privacy Policy.
Thank you!
Please check your email inbox and click the confirmation link to complete your subscription. If you don’t see the email within a few minutes, please also check your spam/junk folder.






