tags:

views:

23

answers:

1

I'm creating a simple app (PHP & MYSQL) that collects information about an event, and I'd like to incorporate natural language processing in the date collection portion. I stumbled upon date.js (www.datejs.com), and it seems like a great fit, but I'm not sure how I'd incorporate it into the input form and then pass the converted string as a variable to the database.

Has anybody successfully implemented this in a PHP environment (or have a better solution)?

+2  A: 

You can do the same with the php function [strtotime][1]

<?php
echo strtotime("now"), "\n";
echo strtotime("10 September 2000"), "\n";
echo strtotime("+1 day"), "\n";
echo strtotime("+1 week"), "\n";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";
?>

[1]: http://www.php.net/manual/en/function.strtotime.php strtotime

adam