[This article was first published on Data science & Software development » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve been calculated my day of 10,000 days old birthday in R since few days ago.
I found that to calculate this in R is quite simple.

My birthday to 10,000 days old birthday:

```> as.Date("1986-09-21") + 10000
 "2014-02-06"
```

Birthday to days since my birthday:

```> Sys.Date() - as.Date("1986-09-21")
Time difference of 10000 days
```

Just for reference, below is an R function to convert a birthday to age.

```# Birthday to age
birthday2age <- function(birthday){
td.y <- as.integer(format.Date(Sys.Date(),"%Y"))
td.m <- as.integer(format.Date(Sys.Date(),"%m"))
td.d <- as.integer(format.Date(Sys.Date(),"%d"))
bd.y <- as.integer(format.Date(birthday,"%Y"))
bd.m <- as.integer(format.Date(birthday,"%m"))
bd.d <- as.integer(format.Date(birthday,"%d"))
return(td.y-bd.y-(td.m<bd.m||(td.m==bd.m&&td.d<bd.d)))
}

> birthday2age("1986-09-21")
 27
```

Reference:  