title: Get newer MySQL Date in Bash-Script
body: <p><br>
  I despair at a simple bash script.<br>
  So..<br>
  I've a MySQL Database running in two different databases there tables which should be synced with the same data - now I'm on a script which should do that for me.<br>
  In the tables theres a column "editeddate" which updates itself when sth edited in this row.<br>
  So the bash script is getting this.<br>
  i.e.<br>
  Table_A: <em>2015-01-09 18:08:54</em><br>
  Table_B: <em>2015-01-09 18:10:09</em><br>
  and now it won't say which of these strings <strong>is newer</strong>..<br>
  Here's the code snipped:<br></p>
  
  <pre><code>table_a=$(mysql -u UID -pPW -D DB -e "SELECT editeddate FROM table_a WHERE id=1" | sed '1d')    #gets sql data without columnname i.e. 2015-01-09 18:08:54
  table_a_date=$(date -d "$table_a")                                                              #converts sql data in bash date
  table_b=$(mysql -u UID -pPW -D DB -e "SELECT editeddate FROM table_b WHERE id=1" | sed '1d')    #gets sql data without columnname i.e. 2015-01-09 18:10:09
  table_b_date=$(date -d "$table_b")                                                              #converts sql data in bash date
  
  if [[ $table_a &gt; $table_b_date ]];                                                              #if table_a is newer than table_b
  then
      echo "table_a is newer"
  elif [[ $table_a &lt; $table_b_date ]];                                                            #otherwise if table_b is newer than table_a
  then
      echo "table_b is newer"
  else                                                                                            #else if both are the same
      echo "Nothing to is newer"
  fi
  </code></pre>
  
  <p><strong>Thanks</strong> :)</p>