Jump to content

[SOLVED] Combining year, month, and day


sanderphp

Recommended Posts

I am trying to learn how to combine the year, month, and day that I getting from 3 different fields so I can use that date in my db. 

 

Would I combine them before writing them like

 

$date = array($dateyear,$datemonth,$dateday);

 

or

 

$datemonth = $_POST['datemonth'];
$dateyear = $_POST['dateyear'];
$dateday = $_POST['dateday'];

$date = $dateyear.$datemonth.$dateday;

 

I'm sure that concatenation method isn't correct, but I haven't done this before.

 

Or would I better off with something like this?

 

$query = "INSERT INTO info (date)
VALUES ('$dateyear $datemonth $dateday')";

Link to comment
https://forums.phpfreaks.com/topic/105865-solved-combining-year-month-and-day/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.