hi all,
Donn't know much php...........
i want that when user register,his registration date store in db.i want to use server date not his system date in db.
i want that when user register,his registration date store in db.i want to use server date not his system date in db.
Php uses the server date, unlike other languages it is not reliant on the users system date and time.
Do you need help coding this or was it just a question?
actually i have a table user_register_mobile in mysql. [Email,MobileNumber,Registratinon_date... are some filed there.] in this table i have a field registration_date.i want to keep date so that i know when user register to our site.
i read about timestamp,some date,time functon of php,but didn't get it. but if u want explain it i am ready to learn
In your mysql table you should set the type to 'timestamp' and then set the default to 'CURRENT TIMESTAMP'.
It doesnt really need to be explained. All that is doing is getting the date and time from the server and sticking it in a field. Just remember not to update it when you update the table, that way it will stay the day the user registrated.
Hope this helps, if you need anything else or i've miss understood dont hesitate to ask.
Also, if you need more info on timestamp and storing the date, i suggest you consult the manual. It contains some really usefull stuff.
$iCurrentTime would result in an integer like: 1236884436
Which is the number of seconds since the Unix Epoch.
You can pass that integer into the php date() function and format it any way you want, and you can also calculate against it simply using basic math.
The only drawback is that it can not store dates after 01/2038 because it will exceed the size of a 32bit integer or Before 01/1970. By 2038 I imagine 64bit hardware or greater will pretty much be the norm.
That is because your column type is set to datetime or timestamp not certain which one actually produces that as I don't use the mysql datetime or timestamp data type.
To store a unix timestamp you just need an INT(10)
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.