Find the Difference Between Two Dates in R Programming - julian() Function Last Updated : 22 Jun, 2020 Comments Improve Suggest changes Like Article Like Report In R programming, difference between two dates can be determined by using basic function julian() and passing date object as the parameter in the function. It ignores the leap-seconds. Syntax: julian(x, origin) Parameters: x: represents date object origin: represents another date object from where difference has to be computed Example 1: r # Define date objects x <- as.Date("2020-06-18") origin_date <- as.Date("2015-05-01") # Difference between dates julian(x, origin_date) Output: [1] 1875 attr(, "origin") [1] "2015-05-01" Example 2: r # Define date objects x <- as.Date("2020-06-18") origin_date <- as.Date("1920-06-18") # Find difference between dates julian(x, origin_date) Output: [1] 36525 attr(, "origin") [1] "1920-06-18" Comment More infoAdvertise with us Next Article Find the Difference Between Two Dates in R Programming - julian() Function U utkarsh_kumar Follow Improve Article Tags : R Language R Date-Function Similar Reads Calculate Time Difference between Dates in R Programming - difftime() Function difftime() function in R Language is used to calculate time difference between dates in the required units like seconds, minutes, days, weeks, etc. Syntax: difftime(date1, date2, units) Parameters:date1, date2: Dates to calculate difference units: seconds, minutes, days, weeksExample 1:R# R program 1 min read Calculate the difference between Consecutive pair of Elements of a Vector in R Programming - diff() Function diff() function in R Language is used to find the difference between each consecutive pair of elements of a vector. Syntax: diff(x, lag, differences) Parameters: x: vector or matrix lag: period between elements differences: Order of difference Example 1: Python3 1== # R program to find the differenc 2 min read Convert a String into Date Format in R Programming - as.Date() Function as.Date() function in R Language is used to convert a string into date format. Syntax: as.Date(x, format) Parameters: x: string variable format: Format in which string is declared(%m/%d/%y) Example 1: Python3 1== # R program to convert string into date # Creating a string vector dates <- c(" 1 min read Determine the Weekday on a Specific Date in R Programming - weekdays() Function weekdays() function in R Language is used to determine the weekday on a specific date passed to it as argument. Syntax: weekdays(date, abbreviate) Parameters: date: Date to be checked abbreviate: Boolean value to abbreviate weekday Example 1: Python3 1== # R program to find the weekday # on a specif 1 min read Determine the Month on a Specific Date in R Programming - months() Function months() function in R Language is used to determine the month on a specific date passed to it as argument. Syntax: months(date, abbreviate) Parameters: date: Date to be checked abbreviate: Boolean value to abbreviate month Example 1: Python3 1== # R program to find the month # on a specific date # 1 min read Like