R: Rectify Date

recdate {RSEIS} | R Documentation

## Rectify Date

### Description

Rectify a date that may be out of wack.

### Usage

    recdate(jd=0, hr=0, mi=0, sec=0, yr=0)
    recdatel(X)

### Arguments

`jd` | Julian Day
`hr` | hours
`mi` | minutes
`sec` | seconds
`yr` | year

or

`X` | list of date

### Details

Returns date with correct numbers. So if number of seconds is greater than 60, will add to minutes...

### Value

`jd` | Julian Day
`hr` | hours
`mi` | minutes
`sec` | seconds
`yr` | year

### Note

Default value for jd is 1, the rest are 0. This function now should successfully span year breaks. Leap years are correctly accounted for too.

### Author(s)

Jonathan M. Lees<jonathan.lees.edu>

### See Also

showdatetime, DAYSperYEAR, fromjul,getjul, tojul, getmoday

### Examples

    recdate(76, 23, 22, yr=2000)

    ###########  example spanning leap year
    ##  start on Day 1, but subtract 36 hours and proceed to plus 36 hours
    hrs <- seq(from=-36, to=36, by=2)
    rd <- recdate(jd=1, hr=hrs, mi=34,
           sec=23+runif(n=length(hrs), 0, 59) , yr=2009)
    write.table(data.frame(rd))

    ###########  example spanning non-leap year
    rd2 <- recdate(jd=1, hr=hrs, mi=34,
         sec=23+runif(n=length(hrs), 0, 59) , yr=2008)
    write.table(data.frame(rd2))

[Package RSEIS version 3.7-4 Index]