0

When user uploads content it enters php varable $date into value of one of the colums on a table. How would you make the php variable the current date, time is not needed just date.

I tried to do this as a string but it shows "CURDATE();" instead of the actual current date

$date="CURDATE();";
Alex
  • 705
  • 4
  • 14
Jeff
  • 958
  • 1
  • 12
  • 31

2 Answers2

1
$date = date('Y-m-d');

This is documented very well here: http://php.net/manual/en/function.date.php

Please, at least try to find a solution yourself next time, this is a very basic thing and is easily found by google.

Janis Vepris
  • 587
  • 3
  • 13
0

You can use php date() function. You can use CURDATE() in mysql query.

$date = date("Y-m-d");
Anant Kumar Singh
  • 68,309
  • 10
  • 50
  • 94
pinkal vansia
  • 9,980
  • 5
  • 47
  • 62