computeCtime_days: Calculates the difference of time between two dates in days

Description Usage Arguments Details Value Author(s) See Also Examples

Description

R Implementation of the SPSS CTIME.DAYS Function. computeCtime_days is a helper function for xpssCompute.

Usage

1

Arguments

x

atomic object of class character, POSIXlt or POSIXt holding date data

date

atomic object of class character, POSIXlt or POSIXt holding date data

Details

The input format of the date's is "YYYY-MM-DD" as Date, and with timeparameters YYYY-MM-DD HH:MM:SS.

Examples:

Date w/o Time Date with Time
YYYY-MM-DD YYYY-MM-DD HH:MM:SS
2015-01-01 2015-01-01 00:00:00
2015-12-31 2015-12-31 23:59:59

It is possible to calculate the difference between the dates, even if they do not have the same structure. It is possible to match dates without time paramters, with dates which contain the time parameters. Additionally it is possible to match dates which are not in the right format.

Note: The calculation of two dates, one with the format YYYY-MM-DD and the other one with the format DD-MM-YYYY is valid, but not recommended.

Value

computeCtime_days returns the difference between x and date in days.

Author(s)

Bastian Wiessner

See Also

difftime DateTimeClasses as.POSIXlt strptime

Examples

1
2
xpssCompute(x="2013-09-14", fun="computeCtime_days", date="2013-09-11")
xpssCompute(x="2015-11-28", fun="computeCtime_days", date="2014-11-28")


Search within the translateSPSS2R package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.