||09-14-2008 10:03 PM
help me figure out this date thing
i created this application where a user signs up for something what i want to do is the second the user signs up the date that is inserted into the db is 3 weeks ahead of the signup date for example.
if i signed up on the application todays date would be 9/14/2008 and the date that is inserted into the database would be 10/5/2008 (which is 3 weeks ahead of the sign up date)
how would this be codded???
||09-14-2008 10:22 PM
Originally Posted by Karl
thanks, but how do i show that as ##/##/## format?
||09-14-2008 10:31 PM
||09-15-2008 02:23 AM
Amazing! I never knew it was this easy to find future/previous dates and times!
||09-15-2008 04:20 PM
Looking forwards, with more recent versions of PHP (5.3 I think) we can make use of the
objects. For example, to add three weeks we could do the following:
<?php header('Content-Type: text/plain;charset=utf-8'); error_reporting(E_ALL | E_STRICT);
$now = new DateTime();
$future = clone $now;
$interval = new DateInterval('P3W');
// or, $interval = date_interval_create_from_date_string('+3 weeks');
// or, date_add($future, $interval);
echo 'Current time: ',
$now->format('jS M Y H:i:s'),
'Future time: ',
$future->format('jS M Y H:i:s');
|All times are GMT. The time now is 05:26 PM.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0