Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199903

Re: [PHP3] date/time problem From: Richard Lynch (lynch <email protected>)
Date: 03/23/99

At 7:35 AM 3/23/99, a. otto wrote:
>hello,
>
>time has come that i have again some problems ;-)

Don't post questions in triplicate. Patience is a virtue.

>in two of the formfields the current date (23.03.1999) and time
>(07:18:12) is shown. to make it more difficult the user can change the
>settings and use whatever time and date he wants. so i pass it to
>another page which inserts the settings to a datbase.
>
>whenever i select these informations form the database i get the
>following information out of the m$-access database:
>date: 23.03.1999 00:00:00
>time: 01.01.1899 07:18:12
>
>so i decided to convert the date and time variables to unix-timestamp
>and there is my problem. i don't know how...

$date = '23.03.1999 00:00:00';
$time = '01.01.1899 07:18:12';
$date = explode(' ', $date);
$dmy = explode(':', $date[0]);
$day = $dmy[0];
$month = $dmy[1];
$year = $dmy[2];
$time = explode(' ', $time);
$hms = explode(':', $time[1]);
$hour = $hms[0];
$minute = $hms[1];
$second = $hms[2];
$unixtime = mktime($hour, $minute, $second, $day, $month, $year);
//Except I always screw up the order of these 6 arguments. Look it up.

-- "TANSTAAFL" Rich lynch <email protected> webmaster@ and www. all of:
R&B/jazz/blues/rock - jademaze.com music industry org - chatmusic.com
acoustic/funk/world-beat - astrakelly.com sculptures - olivierledoux.com
my own nascent company - l-i-e.com cool coffeehouse - uncommonground.com

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>