Jump to content

[SOLVED] Convert Nr to date


web_master

Recommended Posts

Hi,

 

 

 

When visitor enter some text in Form I put the (expire) datetime too into dBase like: 20081010

 

Mysql table is:

 

id

text (TEXT)

date_expire (INT) 00000000

datetime (DATETIME) 0000-00-00 00:00:00

 

in table is `date_expire` Date of expire is equal with a date when put the text into dBase.

 

$query_return = mysql_query( "SELECT * FROM `text` WHERE `date_expire` ... " );

 

SO, I want to visitors see the text only 15 days. As I see I must convert the date_expire into date and... ??? :(

 

How can the visitor see the text 15 days from date given in date_expire to next 15 days?

 

thxs in advanced.

 

T

Link to comment
https://forums.phpfreaks.com/topic/127814-solved-convert-nr-to-date/
Share on other sites

look up interval mysql mate...........

 

Hm... is that mean that I can use the datetime (DATETIME) 0000-00-00 00:00:00, and...

 

$query_return = mysql_query( "SELECT * FROM `text` WHERE `datetime` ... " );

 

Sorry, Im not a best in PHP (and MySQL), so I dont understand clarly...

hi, thank You all of You for associations, here is the solution for my problem:

 

$query_return = mysql_query( "SELECT * FROM `table` WHERE  DATE_ADD(`datetime`, INTERVAL 15 DAY) >= '".date("Y-m-d H:i:s")."' ");

 

In lots of time enough to tell me what do I search on internet for a solution :)

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.