Jump to content

Timestamp... what format to use, how to check against...


cgm225

Recommended Posts

I am writing a script to allow users to comment on blog entries.  I have the following mysql comments table:

 

id  ||  comment  ||  for  ||  ip  ||  timestamp

 

 

I want to do the following: when a comment is added, store a timestamp marking the time of comment creation.  Then, if the entry is less than 2 minutes old, allow editing and/or deleting of the comment by that user based on his/her ip address.  I also want to prevent new comments from being added more than 1 per five minute period.

 

My question is, what time format should I be storing my timestamp in, and how would you compare it against the timeouts I have outlined above?

 

Thanks again, and any other feedback is appreciated!

Im sorry to say but 1 comment per 5minutes seems a little daft even if you mean per user. Say you have 5 people that work in the same office or off the same ip number and they all use your site that means they all have to fight to make a post! Say you have a dormatry of students how can they comment?

 

If you just use the date in mysql and NOW() it do it in the ymdhis format which can be changed when you do a query anyhow.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.