EVOLUTION-MANAGER
Edit File: weekday.POSIXt.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Extract Parts of a POSIXt or Date Object</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for weekdays {base}"><tr><td>weekdays {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Extract Parts of a POSIXt or Date Object</h2> <h3>Description</h3> <p>Extract the weekday, month or quarter, or the Julian time (days since some origin). These are generic functions: the methods for the internal date-time classes are documented here. </p> <h3>Usage</h3> <pre> weekdays(x, abbreviate) ## S3 method for class 'POSIXt' weekdays(x, abbreviate = FALSE) ## S3 method for class 'Date' weekdays(x, abbreviate = FALSE) months(x, abbreviate) ## S3 method for class 'POSIXt' months(x, abbreviate = FALSE) ## S3 method for class 'Date' months(x, abbreviate = FALSE) quarters(x, abbreviate) ## S3 method for class 'POSIXt' quarters(x, ...) ## S3 method for class 'Date' quarters(x, ...) julian(x, ...) ## S3 method for class 'POSIXt' julian(x, origin = as.POSIXct("1970-01-01", tz = "GMT"), ...) ## S3 method for class 'Date' julian(x, origin = as.Date("1970-01-01"), ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an object inheriting from class <code>"POSIXt"</code> or <code>"Date"</code>.</p> </td></tr> <tr valign="top"><td><code>abbreviate</code></td> <td> <p>logical vector (possibly recycled). Should the names be abbreviated?</p> </td></tr> <tr valign="top"><td><code>origin</code></td> <td> <p>an length-one object inheriting from class <code>"POSIXt"</code> or <code>"Date"</code>.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>arguments for other methods.</p> </td></tr> </table> <h3>Value</h3> <p><code>weekdays</code> and <code>months</code> return a character vector of names in the locale in use. </p> <p><code>quarters</code> returns a character vector of <code>"Q1"</code> to <code>"Q4"</code>. </p> <p><code>julian</code> returns the number of days (possibly fractional) since the origin, with the origin as a <code>"origin"</code> attribute. All time calculations in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> are done ignoring leap-seconds. </p> <h3>Note</h3> <p>Other components such as the day of the month or the year are very easy to compute: just use <code><a href="as.POSIXlt.html">as.POSIXlt</a></code> and extract the relevant component. Alternatively (especially if the components are desired as character strings), use <code><a href="strptime.html">strftime</a></code>. </p> <h3>See Also</h3> <p><code><a href="DateTimeClasses.html">DateTimeClasses</a></code>, <code><a href="Dates.html">Date</a></code> </p> <h3>Examples</h3> <pre> weekdays(.leap.seconds) months(.leap.seconds) quarters(.leap.seconds) ## Julian Day Number (JDN, https://en.wikipedia.org/wiki/Julian_day) ## is the number of days since noon UTC on the first day of 4317 BC. ## in the proleptic Julian calendar. To more recently, in ## 'Terrestrial Time' which differs from UTC by a few seconds ## See https://en.wikipedia.org/wiki/Terrestrial_Time julian(Sys.Date(), -2440588) # from a day floor(as.numeric(julian(Sys.time())) + 2440587.5) # from a date-time </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>