3

In grocery_crud and Code Igniter in table Employees I have column today(dd/mm/yyyy). How to set column to display current date. Please help me.

1 Answers1

0

With MySQL you can't do this with a Date but with a Timestamp column, and you add 'CURRENT_TIMESTAMP' as the default value.

That said as of MySQL version 5.6.5 you can do it with :

CREATE TABLE foo (
    `creation_time`     DATETIME DEFAULT CURRENT_TIMESTAMP,
    `modification_time` DATETIME ON UPDATE CURRENT_TIMESTAMP
)

as explained here :

https://stackoverflow.com/a/10603198/1226118

Community
  • 1
  • 1