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
  • 715
  • 5
  • 14
Jeff
  • 1,018
  • 1
  • 15
  • 33

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");
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
pinkal vansia
  • 10,240
  • 5
  • 49
  • 62