title: How to change display format of POSIXct in R Console and RStudio View()
body: <p>I can read in dates from a CSV file to obtain a list of dates and times. My input looks like this:</p>
  
  <pre><code>2018/10/11 15:0:0
  </code></pre>
  
  <p>I read that into p1$hour. I need that in POSIXct, so I convert the string:</p>
  
  <pre><code>p1$timeUtc &lt;- as.POSIXct(p1$hour,tz='Asia/Calcutta')
  </code></pre>
  
  <p>because the times in my CSV file are from India, IST timezone.</p>
  
  <p>When I observe the attributes of p1$timeUtc, I see</p>
  
  <pre><code>attributes(p1$timeUtc)
  $class
  [1] "POSIXct" "POSIXt" 
  $tzone
  [1] "Asia/Calcutta"
  </code></pre>
  
  <p>If I ask for the value of an entry at the R console (within RStudio), I see</p>
  
  <pre><code>p1$timeUtc[[1]]
  [1] "2018-10-11 15:00:00 IST"
  </code></pre>
  
  <p>The $tzone attribute is controlling the display format used. If I change it to UTC I see the same time displayed in a different zone:</p>
  
  <pre><code>&gt; attr(p1$timeUtc,'tzone') &lt;- 'UTC'
  &gt; p1$timeUtc[[1]]
  [1] "2018-10-11 09:30:00 UTC"
  &gt; attr(p1$timeUtc,'tzone') &lt;- 'Asia/Calcutta'
  &gt; p1$timeUtc[[1]]
  [1] "2018-10-11 15:00:00 IST"
  </code></pre>
  
  <p>So I can affect the display format of the POSIXct variable without changing the value of the variable.</p>
  
  <p>But if the csv datum happens to be midnight, <code>2018/10/12 00:0:0</code>, the console output omits the time:</p>
  
  <pre><code>&gt; p1$timeUtc[[2]]
  [1] "2018-10-12 IST"
  </code></pre>
  
  <p>which is a little confusing. I'd just like it to be <code>'%Y-%m-%d %H:%M %Z'</code>.</p>
  
  <p>Further, when I use <code>View(p1)</code> to display the data table in RStudio, that seems to use the tzone attribute, but omits the "IST" at the end. But it does print <code>2018-10-12 00:00:00</code> for midnight. (But maybe that's just because I am looking at a list, not one value?)</p>
  
  <p>I know I can convert a POSIXct to a string and print that out however I want. But I don't want to do that; I want to specify how the R Console displays the POSIXct variable, and how the RStudio <code>View()</code> displays the variable. I can change the time zone used for display. Is there a way to change the format used for the rest? I looked in <code>options</code> for generic control but couldn't find a way.</p>