title: Postgres : invalid input syntax for type timestamp with time zone: ""
body: <p>I am new to Postgres DB. I am getting the error:</p>
  <blockquote>
  <p>invalid input syntax for type timestamp with time zone: &quot;&quot;</p>
  </blockquote>
  <p>when trying to run the below query from java. &quot;:from_date&quot; and &quot;:upto_date&quot; will be replaced with null while executing in java. Any ideas on how to resolve this?</p>
  <pre><code>select tm.*
  from team tm
   and tm.schedule_finish  &gt;=  (case
                                   when :from_date is null or :upto_date is null  
                                         then TO_CHAR(to_date(concat(TO_CHAR(LOCALTIMESTAMP - INTERVAL '1 month','YYYY-MM') , '-01'),'YYYY-MM-DD'),'YYYY-MM-DD')
                                    when (date_part('year',age(:upto_date,:from_date))*12+date_part('month',age(:upto_date,:from_date)))&gt;36 
                                      then TO_CHAR(to_date(concat(TO_CHAR(LOCALTIMESTAMP -INTERVAL '1 month','YYYY-MM') , '-01'),'YYYY-MM-DD'),'YYYY-MM-DD')
                                   else TO_CHAR(:from_date,'YYYY-MM-DD')
                                 end)::timestamp
  </code></pre>