Date form to unix timestamp I'm using Drupal 7.8, and am trying to get the user to specify a date using the drupal date form. I want to take this date, and save it to a database as a unix timestamp. The trouble is, I think the data given by the date form is based on the user's current timezone. Does drupal provide anyway to convert the form data back to unix time? Is there an easier way to handle dates?
I'm pretty sure the values stored using the date attribute are unaltered and just passed on in an array. So the question would be if the user submits the date for UTC or his/her timezone. I would say the latter ;-)

I'm no expert on date settings and timezones, but had seen this question before on stackoverflow, so taking that into account I assume you can do this:

global $user;
$datefields = $form_state['values']['submitted_date'];
$submittedDate = "{$datefields['year']}-{$datefields['month']}-{$datefields['day']}";
$timezone = $user-&gt;timezone;
$newdate = new DateTime($submittedDate, new DateTimeZone($timezone));
$unixts = $newdate-&gt;getTimestamp();


This would require the user to have set his/her timezone accurately in the account settings.