Ask about general coding issues or problems here.
Moderators: macek, egami, gesf
- New php-forum User
- Posts: 4
- Joined: Tue Jul 30, 2013 6:38 am
Currently i have developed a file processing system. One of the system function is to count number of days
Which should not exceed 30 days to process an application. If exceed 30 days, flash message appears to inform user processing date exceded 30 days. Any example how to write function for this?
I m using codeigniter php.
- php-forum Super User
- Posts: 1805
- Joined: Thu Mar 10, 2011 5:07 pm
something like this:
Code: Select all
// do necessary validations
// todays date should be in the same format as that of application date
$diff_in_secs = strtotime($todays_date) - strtotime($app_date);
$diff_in_days = floor($diff_in_secs/3600/24);
if ($diff_in_days > 30)
Usually this function is placed in the Library of CI. A controller call is then placed to this function and if the function returns TRUE then appropriate view is loaded to flash the message.
Return to “PHP coding => General”
Who is online
Users browsing this forum: No registered users and 1 guest