View Full Version : date difference in php
12-15-2008, 07:59 AM
I have one doubt regarding date.i have to insert the one date in my database.this field is used to the user is valid for that particular date.if that date exceeds,user shouldn't login his account.i don't know how that particular date exceeds?can anyone help me.thanks in advance..
12-15-2008, 08:43 AM
Why not just use MySQL's date functions? As long as your date is stored as a data type of "date" (it is, right?) then you can perform all kinds of functions on that date.
12-15-2008, 09:22 AM
no i used the datatype varchar for date field.for example i gave 14.12.2008 in date field.if the user login today means,he will get the message 'you had crossed the valid date,contact admin'.
i don't know how this did in mysql.can u tell me how i do this in both php and mysql.
12-15-2008, 09:42 AM
You really should store the date in an appropiate data type. From there you can just perform MySQL date functions that will handle most things for you. :thumbsup:
12-15-2008, 09:48 AM
For date i recommend mysql DATE format YYYY-DD-MM..
12-15-2008, 10:31 AM
Also, just as a side note...you may want to backup your information before you attempt to convert it since simply changing your data type from varchar (in an inappropiate format) will truncate your current values and replace them with 0000-00-00 or something similar.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.