Convert variables

I'm trying calculate time between dates(with mktime).

$dateDiff = mktime(16,33,00,11,11,2004) - mktime(16,30,44,11,11,2004);
echo 'Difference in seconds: ' . $dateDiff . '<br />';

echo '<br />Years Difference   = '. floor($dateDiff/365/60/60/24);
echo '<br />Months Difference  = '. floor($dateDiff/60/60/24/7/4);
echo '<br />Weeks Difference   = '. floor($dateDiff/60/60/24/7);
echo '<br />Days Difference    = '. floor($dateDiff/60/60/24);
echo '<br />Hours Difference   = '. floor($dateDiff/60/60);
echo '<br />Minutes Difference = '. floor($dateDiff/60);

The problem is, if i save the information: 16,33,00,11,11,2004 in the MsSQL Data Base in a char field when i get it to put inside the mktime like:

$TimeStamp = '16,30,44,11,11,2004';
mktime($TimeStamp)

it doesn't work... mabe i should split like this:

list($Hour, $Minutes, $Seconds, $Months, $Day, $Year) = split('[,]', $TimeStamp);

and then convert them to integer... Can anyone help me?

thx in advanced
LVL 1
justaphaseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
If you have that format, use the method you described. You don't need to convert them to integer (this will be done by PHP) and then use those variables in mktime like this:
mktime($Hour, $Minutes, $Seconds, $Months, $Day, $Year);
There are a lot of other way, but they willl end up in such function call.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Diablo84Commented:
If you are going to do it with list i would use explode instead, split uses regular expressions and is more then is needed here:

list($Hour, $Minutes, $Seconds, $Months, $Day, $Year) = explode(",", $TimeStamp);
0
justaphaseAuthor Commented:
And again... it was so easy...

Thank you...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.