R – Current Date

To get current date in R, call Sys.Date() function. Sys.Date() returns current date in the current time zone, with an accuracy of milli-second.

In this tutorial, we will learn how to get current date in R using Sys.Date() function.

Syntax

The syntax to get current date in R is

Sys.Date()

Return Value

Sys.Date() returns a Date object.

ADVERTISEMENT

Examples

In the following program, we get the current date in the system, using Sys.Date() function.

example.R

currentDate <- Sys.Date()
print(currentDate)

Output

[1] "2021-06-13"

Conclusion

In this R Tutorial, we learned how to get current date in System in R using Sys.Date() function, with the help of examples.