EVOLUTION-MANAGER
Edit File: excel_numeric_to_date.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: Convert dates encoded as serial numbers to Date class.</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 excel_numeric_to_date {janitor}"><tr><td>excel_numeric_to_date {janitor}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Convert dates encoded as serial numbers to Date class.</h2> <h3>Description</h3> <p>Converts numbers like <code>42370</code> into date values like <code>2016-01-01</code>. </p> <p>Defaults to the modern Excel date encoding system. However, Excel for Mac 2008 and earlier Mac versions of Excel used a different date system. To determine what platform to specify: if the date 2016-01-01 is represented by the number 42370 in your spreadsheet, it's the modern system. If it's 40908, it's the old Mac system. More on date encoding systems at http://support.office.com/en-us/article/Date-calculations-in-Excel-e7fe7167-48a9-4b96-bb53-5612a800b487. </p> <p>A list of all timezones is available from <code>base::OlsonNames()</code>, and the current timezone is available from <code>base::Sys.timezone()</code>. </p> <p>If your input data has a mix of Excel numeric dates and actual dates, see the more powerful functions <code>convert_to_date()</code> and <code>convert_to_datetime()</code>. </p> <h3>Usage</h3> <pre> excel_numeric_to_date( date_num, date_system = "modern", include_time = FALSE, round_seconds = TRUE, tz = "" ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>date_num</code></td> <td> <p>numeric vector of serial numbers to convert.</p> </td></tr> <tr valign="top"><td><code>date_system</code></td> <td> <p>the date system, either <code>"modern"</code> or <code>"mac pre-2011"</code>.</p> </td></tr> <tr valign="top"><td><code>include_time</code></td> <td> <p>Include the time (hours, minutes, seconds) in the output? (See details)</p> </td></tr> <tr valign="top"><td><code>round_seconds</code></td> <td> <p>Round the seconds to an integer (only has an effect when <code>include_time</code> is <code>TRUE</code>)?</p> </td></tr> <tr valign="top"><td><code>tz</code></td> <td> <p>Time zone, used when <code>include_time = TRUE</code> (see details for more information on timezones).</p> </td></tr> </table> <h3>Details</h3> <p>When using <code>include_time=TRUE</code>, days with leap seconds will not be accurately handled as they do not appear to be accurately handled by Windows (as described in https://support.microsoft.com/en-us/help/2722715/support-for-the-leap-second). </p> <h3>Value</h3> <p>Returns a vector of class Date if <code>include_time</code> is <code>FALSE</code>. Returns a vector of class POSIXlt if <code>include_time</code> is <code>TRUE</code>. </p> <h3>See Also</h3> <p>Other Date-time cleaning: <code><a href="convert_to_date.html">convert_to_date</a>()</code> </p> <h3>Examples</h3> <pre> excel_numeric_to_date(40000) excel_numeric_to_date(40000.5) # No time is included excel_numeric_to_date(40000.5, include_time = TRUE) # Time is included excel_numeric_to_date(40000.521, include_time = TRUE) # Time is included excel_numeric_to_date(40000.521, include_time = TRUE, round_seconds = FALSE) # Time with fractional seconds is included </pre> <hr /><div style="text-align: center;">[Package <em>janitor</em> version 2.1.0 <a href="00Index.html">Index</a>]</div> </body></html>