title: Date shows up as number
body: <p>I have fetched a set of dates from postgresql, they look correct:</p>
  
  <pre><code>[1] "2007-07-13" "2007-07-14" "2007-07-22" "2007-07-23" "2007-07-24"
  [6] "2007-07-25" "2007-08-13" "2007-08-14" "2007-08-15" "2007-08-16"
  etc.
  </code></pre>
  
  <p>Then I want to run a loop on them to make new sql sentences to fetch some other data sets (yes, I know what I am doing, it would not have been possible to do all the processing in the database server)</p>
  
  <p>So I tried</p>
  
  <pre><code>for(date in geilodates)
   mapdate(date,geilo)
  Error in postgresqlExecStatement(conn, statement, ...) : 
    RS-DBI driver: (could not Retrieve the result : ERROR:  invalid input syntax for type date: "13707"
  LINE 1: ...id_date_location where not cowid is null and date='13707' or...
  </code></pre>
  
  <p>mapdate is a function I have written, the use of date within that is </p>
  
  <pre><code>sql=paste('select * from gps_coord where cowid=',cowid," and date='",date,"'",sep='')
  </code></pre>
  
  <p>So, what has happened is that R silently converted my formatted dates to their integer representations before i tried to paste the sql together. </p>
  
  <p>How do I get the original textual representation of the date? I tried</p>
  
  <pre><code>for(date in geilodates){
    d=as.Date(date,origin="1970-01-01")
    mapdate(d,geilo)
  }
  Error in charToDate(x) : 
  character string is not in a standard unambiguous format
  </code></pre>
  
  <p>And I have not managed to find any other functions to create a datestring (or to "serve" the date as the string I get when listing the variable</p>