View source: R/date_conversion.R
generate_dtc | R Documentation |
Convert dates and times to SDTM-formatted ISO8601 datetime values
generate_dtc(
datetime = NULL,
date = NULL,
time = NULL,
early_hour = "05",
assume_24_hr_time = FALSE
)
datetime |
A combined date/time representation (either an ISO8601-formatted character string or a POSIXt object). |
date |
The date (either an ISO8601-formatted character string, a Date object, or a POSIXt object). |
time |
The time (an ISO8601-formatted character string) |
early_hour |
An hour of the day that would suggest times that are not zero padded are from a 12-hour clock instead of a 24-hour clock. (See Details) |
assume_24_hr_time |
Assume that times of day are from a 24-hour clock even if the hour is an 'early_hour'. (See Details) |
When times are not zero-padded (for example, "5:12" instead of "05:12"), the probability that they are from a 12-hour clock instead of a 24-hour clock is increased. To minimize the impact of this, when the length of any time character string is 4 or 7 characters, times are less than the 'early_hour' will trigger an error under the assumption that generally activities are not happening in the middle of the night. If the times are known to be accurate, setting 'assume_24_hr_time=TRUE' will prevent the error and simply pad the strings with zeros.
If a non-NA value is given for 'datetime', then values in 'date' and 'time' will be ignored.
An SDTM-formatted ISO8601 date-time with "UN:UN:UN" if the time is 'NA'. If all inputs are 'NA', then the output is also 'NA'.
Other Date management and conversion:
dateany_to_date()
,
is_ISO8601_calendar_date()
,
is_ISO8601_calendar_datetime()
,
is_ISO8601_ordinal_datetime()
,
is_ISO8601_time()
,
is_ISO8601_timezone()
,
is_ISO8601_week_datetime()
,
make_dy()
,
pattern_ISO8601_any_date()
,
pattern_ISO8601_any_datetime()
,
pattern_ISO8601_calendar_date()
,
pattern_ISO8601_calendar_datetime()
,
pattern_ISO8601_calendar_year()
,
pattern_ISO8601_ordinal_date()
,
pattern_ISO8601_ordinal_datetime()
,
pattern_ISO8601_time()
,
pattern_ISO8601_timezone()
,
pattern_ISO8601_week_date()
,
pattern_ISO8601_week_datetime()
,
sdtm_dtc_to_datetime()
,
sdtm_first_dose()
,
sdtm_time_actual()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.