% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/date_conversion.R
\name{generate_dtc}
\alias{generate_dtc}
\title{Convert dates and times to SDTM-formatted ISO8601 datetime values}
\usage{
generate_dtc(
  datetime = NULL,
  date = NULL,
  time = NULL,
  early_hour = "05",
  assume_24_hr_time = FALSE
)
}
\arguments{
\item{datetime}{A combined date/time representation (either an
ISO8601-formatted character string or a POSIXt object).}

\item{date}{The date (either an ISO8601-formatted character string, a Date
object, or a POSIXt object).}

\item{time}{The time (an ISO8601-formatted character string)}

\item{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)}

\item{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)}
}
\value{
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`.
}
\description{
Convert dates and times to SDTM-formatted ISO8601 datetime values
}
\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.
}
\seealso{
Other Date management and conversion: 
\code{\link{dateany_to_date}()},
\code{\link{is_ISO8601_calendar_datetime}()},
\code{\link{is_ISO8601_calendar_date}()},
\code{\link{is_ISO8601_ordinal_datetime}()},
\code{\link{is_ISO8601_timezone}()},
\code{\link{is_ISO8601_time}()},
\code{\link{is_ISO8601_week_datetime}()},
\code{\link{make_dy}()},
\code{\link{pattern_ISO8601_any_datetime}()},
\code{\link{pattern_ISO8601_any_date}()},
\code{\link{pattern_ISO8601_calendar_datetime}()},
\code{\link{pattern_ISO8601_calendar_date}()},
\code{\link{pattern_ISO8601_calendar_year}()},
\code{\link{pattern_ISO8601_ordinal_datetime}()},
\code{\link{pattern_ISO8601_ordinal_date}()},
\code{\link{pattern_ISO8601_timezone}()},
\code{\link{pattern_ISO8601_time}()},
\code{\link{pattern_ISO8601_week_datetime}()},
\code{\link{pattern_ISO8601_week_date}()},
\code{\link{sdtm_dtc_to_datetime}()},
\code{\link{sdtm_first_dose}()},
\code{\link{sdtm_time_actual}()}
}
\concept{Date management and conversion}
