title: Compare date from CSV to reference date
body: <p>I am parsing a CSV file using a PowerShell script. I would like to compare date read from the CSV file with current date and do certain operation or exit processing script. Can any one help me on below issue?</p>
  
  <p>Date in the CSV file is like below:<br>
  Trading Date:,2015-12-14</p>
  
  <pre><code>$CurrentTimeStamp = Get-Date
  $TradeDate = $CurrentTimeStamp.ToString("yyyyMMdd")
  $CheckDate = $TradeDate
  </code></pre>
  
  <p>TradeDate is as above:</p>
  
  <pre><code>$FileTradeDate = $Cols[1]
  $TradeDate = $FileTradeDate.ToString("yyyy-MM-dd")
  if ($TradeDate -ne $CheckDate) {
    $host.Exit()
  } else {
    $TradeDate = $FileTradeDate
    LogWrite $TradeDate
  }
  </code></pre>
  
  <p>I am getting below error:</p>
  
  <pre class="lang-none prettyprint-override"><code>Cannot find an overload for "ToString" and the argument count: "1".
  At \\multinasdub301\Software\SysAdmin\WebDownloads\ProcessUBSFrescoCCYHDG.ps1:139 char:5
  +                 $TradeDate = $FileTradeDate.ToString("yyyy-MM-dd")
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [], MethodException
      + FullyQualifiedErrorId : MethodCountCouldNotFindBest
  </code></pre>