Learn R Programming

M3 (version 0.3)

combine.date.and.time: 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

See Also

DateTimeClasses, strptime

Examples

Run this code
## 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))

Run the code above in your browser using DataLab