# Find the Difference Between Two Dates in R Programming – julian() Function

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 objectorigin:represents another date object from where difference has to be computed

**Example 1:**

`# 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:**

`# 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"