[R-sig-Geo] Convert units hours since 1950-01-01 00:00:00 to date
Eko Susilo
ekosusilo at live.com
Wed Dec 31 10:50:59 CET 2014
Hi Rowlingson
thanks you, your command is working well
On 31/12/2014 16:39, Barry Rowlingson wrote:
> On Wed, Dec 31, 2014 at 6:22 AM, Eko Susilo <ekosusilo at live.com> wrote:
>> as.Date(as.POSIXct(timeval, origin="1950-01-01"))
>
> as.Date works with number of days, so try:
>
> > as.Date(timeval/24, origin="1950-01-01")
> [1] "2014-11-29"
>
> as.POSIXct works with seconds, so try:
>
> > as.POSIXct(timeval*60*60, origin="1950-01-01")
> [1] "2014-11-29 12:00:00 GMT"
>
> I recommend as.Date if you only want dates and not date-times and your
> data is really integer days.
>
> Barry
More information about the R-sig-Geo
mailing list