Open In App
Related Articles

Get Date and Time in different Formats in R Programming – date(), Sys.Date(), Sys.time() and Sys.timezone() Function

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
date() function in R Language is used to return the current date and time.
Syntax: date() Parameters: Does not accept any parameters
Example:
# R program to illustrate
# date function
  
# Calling date() function to 
# return current date and time
date()

                    
Output:
[1] "Thu Jun 11 04:29:39 2020"

Sys.Date() Function

Sys.Date() function is used to return the system’s date.
Syntax: Sys.Date() Parameters: Does not accept any parameters
Example:
# R program to illustrate
# Sys.Date function
  
# Calling Sys.Date() function to 
# return the system's date
Sys.Date()

                    
Output:
[1] "2020-06-11"

Sys.time()

Sys.time() function is used to return the system’s date and time.
Syntax: Sys.time() Parameters: Does not accept any parameters
Example:
# R program to illustrate
# Sys.time function
  
# Calling Sys.time() function to 
# return the system's date and time
Sys.time()

                    
Output:
[1] "2020-06-11 05:35:49 UTC"

Sys.timezone()

Sys.timezone() function is used to return the current time zone.
Syntax: Sys.timezone() Parameters: Does not accept any parameters
Example:
# R program to illustrate
# Sys.timezone function
  
# Calling Sys.timezone() function to 
# return the current time zone
Sys.timezone()

                    
Output:
[1] "Etc/UTC"

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!


Last Updated : 12 Jun, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads