1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/time_calendar.R
\name{stri_datetime_fields}
\alias{stri_datetime_fields}
\title{Get Values for Date and Time Fields}
\usage{
stri_datetime_fields(time, tz = attr(time, "tzone"), locale = NULL)
}
\arguments{
\item{time}{an object of class \code{\link{POSIXct}}
(\code{as.POSIXct} will be called on character vectors
and objects of class \code{POSIXlt}, \code{Date}, and \code{factor})}
\item{tz}{\code{NULL} or \code{''} for the default time zone or
a single string with time zone identifier, see \code{\link{stri_timezone_list}}}
\item{locale}{\code{NULL} or \code{''} for the current default locale,
or a single string with a locale identifier; a non-Gregorian calendar
may be specified by setting \code{@calendar=name} keyword}
}
\value{
Returns a data frame with the following columns:
\enumerate{
\item Year (0 is 1BC, -1 is 2BC, etc.)
\item Month (1-based, i.e., 1 stands for the first month, e.g., January;
note that the number of months depends on the selected calendar,
see \code{\link{stri_datetime_symbols}})
\item Day
\item Hour (24-h clock)
\item Minute
\item Second
\item Millisecond
\item WeekOfYear (this is locale-dependent)
\item WeekOfMonth (this is locale-dependent)
\item DayOfYear
\item DayOfWeek (1-based, 1 denotes Sunday; see \code{\link{stri_datetime_symbols}})
\item Hour12 (12-h clock)
\item AmPm (see \code{\link{stri_datetime_symbols}})
\item Era (see \code{\link{stri_datetime_symbols}})
}
}
\description{
Computes and returns values for all date and time fields.
}
\details{
Vectorized over \code{time}.
}
\examples{
stri_datetime_fields(stri_datetime_now())
stri_datetime_fields(stri_datetime_now(), locale='@calendar=hebrew')
stri_datetime_symbols(locale='@calendar=hebrew')$Month[
stri_datetime_fields(stri_datetime_now(), locale='@calendar=hebrew')$Month
]
}
\seealso{
The official online manual of \pkg{stringi} at \url{https://stringi.gagolewski.com/}
Gagolewski M., \pkg{stringi}: Fast and portable character string processing in R, \emph{Journal of Statistical Software} 103(2), 2022, 1-59, \doi{10.18637/jss.v103.i02}
Other datetime:
\code{\link{stri_datetime_add}()},
\code{\link{stri_datetime_create}()},
\code{\link{stri_datetime_format}()},
\code{\link{stri_datetime_fstr}()},
\code{\link{stri_datetime_now}()},
\code{\link{stri_datetime_symbols}()},
\code{\link{stri_timezone_get}()},
\code{\link{stri_timezone_info}()},
\code{\link{stri_timezone_list}()}
}
\concept{datetime}
\author{
\href{https://www.gagolewski.com/}{Marek Gagolewski} and other contributors
}
|