Auto add days to datetime as each days passes in mysql -
i want make column in mysql database when user login first time in system, stores datetime in mysql table. , since day in other column days add according register date. 1, 2, 3,....and on. so, there way can achieve results? please guide me soon.
you can 1 column (to hold registration / first login date) , datediff function:
create table users ( id int(11) not null auto_increment, name varchar(20) not null, registered_at datetime not null, primary key (id) ); insert users set name = 'myname', registered_at = now(); select registered_at, datediff(now(), registered_at) days_since users name = 'myname';
Comments
Post a Comment