title: PHP: Convert a german date format (%d.%m.%Y) into a valid unix timestamp?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2167916/convert-one-date-format-into-another-in-php">Convert one date format into another in PHP</a>  </p>
  </blockquote>
  
  
  
  <p>I know there are plenty of posts out there, however there is not any validated or accepted answer that explains that well!</p>
  
  <p>I'm working with Wordpress and use this to save a date into a database …</p>
  
  <p><code>update_post_meta($post-&gt;ID, "event_date", $_POST["_wr_event_date"]);</code></p>
  
  <p>I simply put in my desired date like 08.05.2012 into the <code>_wr_event_date</code> Field and it successfully gets stored into the database. However for further stuff I need this date to be sortable and I want to convert it into a unix timestamp. </p>
  
  <p>How can I convert my entered date value "08.05.2012" (which is in german date format: %d.%m.%Y) to a unix timestamp that represents this time?</p>
  
  <p>I thought of using <code>pdate_post_meta($post-&gt;ID, "event_date", strtotime($_POST["_wr_event_date"]));</code> but I wonder if this is the correct way because I can't think of a reason why <code>strtotime()</code> should automagically know what date format I've put in!?</p>
  
  <p>Any thoughts on that? thank you in advance.</p>