R: Combine date and time to obtain date-time in POSIX format
combine.date.and.time
R Documentation
Combine date and time to obtain date-time in POSIX format
Description
Combine date and time to obtain date-time in POSIX format
Usage
combine.date.and.time(date, time)
Arguments
date
Date in Date format or as character string in format
“YYYY-MM-DD”.
time
Time as list with hours (hrs), minutes
(mins), and seconds (secs) components or as
character string in format HH:MM:SS (with hours ranging
from 00-23).
Value
A date-time in R's POSIX class.
Note
This function is called by get.datetime.seq, get.M3.var, and var.subset, but it will probably not be called by most users.
Author(s)
Jenise Swall
See Also
DateTimeClasses, strptime
Examples
## This function can accept dates as a character string:
combine.date.and.time(date="2011-05-03", time="16:15:30")
## Or, the dates can be in R's Date format.
combine.date.and.time(date=as.Date("2011-05-03"), time="16:15:30")
## The time can also be given as a list:
combine.date.and.time(date="2011-05-03", time=list(hrs=16, mins=15, secs=30))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(M3)
Loading required package: ncdf4
Loading required package: rgdal
Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.3, released 2015/09/16
Path to GDAL shared files: /usr/share/gdal/1.11
Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.2-3
Loading required package: maps
# maps v3.1: updated 'world': all lakes moved to separate new #
# 'lakes' database. Type '?world' or 'news(package="maps")'. #
Loading required package: mapdata
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/M3/combine.date.and.time.Rd_%03d_medium.png", width=480, height=480)
> ### Name: combine.date.and.time
> ### Title: Combine date and time to obtain date-time in POSIX format
> ### Aliases: combine.date.and.time
> ### Keywords: chron
>
> ### ** Examples
>
> ## This function can accept dates as a character string:
> combine.date.and.time(date="2011-05-03", time="16:15:30")
[1] "2011-05-03 16:15:30 GMT"
>
> ## Or, the dates can be in R's Date format.
> combine.date.and.time(date=as.Date("2011-05-03"), time="16:15:30")
[1] "2011-05-03 16:15:30 GMT"
>
> ## The time can also be given as a list:
> combine.date.and.time(date="2011-05-03", time=list(hrs=16, mins=15, secs=30))
[1] "2011-05-03 16:15:30 GMT"
>
>
>
>
>
> dev.off()
null device
1
>