Welcome Guest, Not a member yet? Register   Sign In
Best way to get a future date timestamp
#1

[eluser]internut[/eluser]
$mysql_time = '20091124092345';

$unix = mysql_to_unix($mysql);

?
#2

[eluser]TheFuzzy0ne[/eluser]
Please define "best way".
#3

[eluser]internut[/eluser]
How about a way better then my example?
#4

[eluser]Colin Williams[/eluser]
http://www.php.net/mktime and http://www.php.net/gmmktime
#5

[eluser]slowgary[/eluser]
This is the best way by FAR:
Code:
mt_rand(time(), time() + 9999999999999);
I also like:
Code:
strtotime("grandma's birthday");
#6

[eluser]Dam1an[/eluser]
@slowgary: Love 'em Smile
#7

[eluser]internut[/eluser]
haha good stuff. What i'm trying to do is get a now() time for a future date:

IE:

10-19-2010 with the hour / min / sec being the time now() is created.
#8

[eluser]Colin Williams[/eluser]
Did you even look at mktime() and gmmktime()? You can also just do time() (or now()) + the number of seconds in the future

Code:
$future = now() + ($hrs * 24) * ($min * 60) * ($sec * 60); // You'll need to conditionally multiply what's in the parentheses

You shouldn't get hung up on simple math like this.
#9

[eluser]Jay Logan[/eluser]
For a CRM I'm making at my job, I have a feature on the back end for an administrator to schedule a call to the customer. The date & time is in the future and I convert the post data into a timestamp with this:

Code:
$post_time = strtotime($this->input->post('call_day').'-'.$this->input->post('call_month').'-'.$this->input->post('call_year').' '.$this->input->post('call_hour').':'.$this->input->post('call_minute').' '.$this->input->post('call_ampm'));




Theme © iAndrew 2016 - Forum software by © MyBB