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:

 

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.


Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Top