Jump to content

Holidays


samona

Recommended Posts

Hi,

 

I'm trying to create a query that will look back to a previous entry and retrieve the information on that record. 

 

I figured out how to do it when its Friday.

 

if (date('D') == "Mon")
{

$query = 'SELECT * FROM Table WHERE ((DATE_FORMAT(Table.Current_Date, \'%Y %m %d\')) = (DATE_FORMAT(NOW() - INTERVAL 3 DAY, \'%Y %m %d\'))) && (Type = \'type\')';
}

else
{
$query = 'SELECT * FROM Table WHERE ((DATE_FORMAT(Table.Current_Date, \'%Y %m %d\')) = (DATE_FORMAT(NOW() - INTERVAL 1 DAY, \'%Y %m %d\'))) && (Type = \'type\')';
}

 

However, if there is a holiday, the -3 days will not work since the last record could have been inserted 4 days ago or even 5 days ago. 

 

How would I solve this problem?

Link to comment
https://forums.phpfreaks.com/topic/109742-holidays/
Share on other sites

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.