1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/when.R
3\name{when}
4\alias{when}
5\title{When}
6\usage{
7when(object, tz = "GMT", origin = "1970-01-01", usetz = TRUE)
8}
9\arguments{
10\item{object}{the \code{object} to extract the time slot from.}
11
12\item{tz}{time zone specification to be used for the conversion,
13    \emph{if one is required}.  System-specific (see \link[base]{time zones}),
14    but \code{""} is the current time zone, and \code{"GMT"} is UTC
15    (Universal Time, Coordinated).  Invalid values are most commonly
16    treated as UTC, on some platforms with a warning.}
17
18\item{origin}{a date-time object, or something which can be coerced by
19    \code{as.POSIXct(tz = "GMT")} to such an object.}
20
21\item{usetz}{logical.  Should the time zone abbreviation be appended
22    to the output?  This is used in printing times, and more reliable
23    than using \code{"\%Z"}.}
24}
25\value{
26A \code{character} vector of length one.
27}
28\description{
29Help method to extract the time as a character string from a
30git_commit, git_signature, git_tag and git_time object.
31}
32\examples{
33\dontrun{
34## Initialize a temporary repository
35path <- tempfile(pattern="git2r-")
36dir.create(path)
37repo <- init(path)
38
39## Create a first user and commit a file
40config(repo, user.name = "Alice", user.email = "alice@example.org")
41writeLines("Hello world!", file.path(path, "example.txt"))
42add(repo, "example.txt")
43commit(repo, "First commit message")
44
45## Create tag
46tag(repo, "Tagname", "Tag message")
47
48when(commits(repo)[[1]])
49when(tags(repo)[[1]])
50when(tags(repo)[[1]], tz = Sys.timezone())
51}
52}
53\seealso{
54\code{\link{git_time}}
55}
56