I am making a registration form with 8-10 fields. Apart from this I have 2 other fields in my database, userid which is a primary key wioth auto incrementation and an active field, whether the user is active or not. But I want to add one more field, that is the registration date and store it in IST (Indian Standard Time)
When I click my profile link in stackoverflow, I see that I have registered X months back and I have visited the site X number of times. I want to add a similar feature to the profile of my users which displays the exact date and time when they were registered! Ex, member since: 28/7/2001! Something like that.
Do I have to do any tweak in my registration form? Or do I have to do any other thing? I searched on google and stackoverflow for the same, searched the php and mysql documentation too, saw a lot of things about dates and timestamps but I don’t know how to go about, didn’t get exactly what I wanted and wasn’t convinced enough. Please help me solve this problem.
Thank you!
You don’t need to tweak your form.
Just add field “registration_date” to your “user” table.
Set it to the current date when inserting a new user.
This can be done at the database level.
Something like this:
Your form doesn’t need to pass “registration_date” to the database.
Be aware that NOW() function returns the database server datetime.