Articles

Affichage des articles associés au libellé mysql current date

Add current date and time into MYSQL database

Image
You are building a Bank System?  A cash payment service or user authentication system? You will probably need to add current time and date in your MYSQL database to do so follow those steps. Let say we want to create a little database in mysql for student with 4 columns: id, name, age , dateEntry . It will look just like this: Create database student;  use student ; Create table student (id int(11) NOT NULL AUTO_INCREMENT , name varchar(30) not null ,  age date not null , dateEntry  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  , PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Show databases;  Let's test it on MYSQL console :  Let's insert some data in our database: insert into student (name,age) values ("Jean Stanley","1999-12-12");  N.B:  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP   is the magical line that allow you to insert the current system date in your da...