title: Converting Date to Year-Quarter Format When Using Dbplyr
body: <p>I have a data frame in a database with a date dimension that I pulled using RPostgres/RpostgreSQL and dbplyr. Each date is in the format 'YYYY-MM-DD', and I need to add a new date (or character) dimension that reflects the original date in the year-quarter format &quot;YYYY-Q&quot; (with a dash, not a period).</p>
  <p>Given that I can't use lubridate with dbplyr, how would I accomplish this?</p>
  <p>Thanks for your help! Here's a simplified version of what I have so far so you can see what packages I'm using and how I'm connecting to the database.</p>
  <pre><code># Packages
  library(RPostgres)
  library(RPostgreSQL)
  library(dplyr)
  library(dbplyr)
  
  # Connect to db 
  drv &lt;- dbDriver(&quot;Postgres&quot;)
  
  # Setup connect to db
  conn &lt;- dbConnect(drv,
                    dbname = etc,)
  
  # Define table to use in db
  table &lt;- tbl(conn, in_schema(&quot;xyz&quot;, &quot;abc&quot;))
  
  #Select columns and filter
  df &lt;- table %&gt;%
    #Filter for pertinent data
    filter(date &gt; as.Date(&quot;2018-01-01&quot;) &amp; date &lt;= as.Date(&quot;2020-01-01&quot;)) 
  
   
  </code></pre>