Date question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
David222
Forum Newbie
Posts: 1
Joined: Fri Feb 05, 2010 3:59 pm

Date question

Post by David222 »

I am trying to convert a string to a date...
is this correct?

Code: Select all

    $dob_d = $_POST['new_dd'];
                $dob_m =$_POST['new_mm'];
                $dob_y = $_POST['new_yyyy'];
                $dob = date("$dob_y/$dob_m/$dob_d");
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Date question

Post by pickle »

No. Check the docs for what date() actually does.

You probably want strtotime()
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply