0

I am trying to convert an old office excel sheet document data into PHP web based app for searching and other data analysis. Stuck in how to fields called start_date & end_date. This tells me that if project is active or not. Data saved in below format. It compares both dates and return the project status by comparing with current date.

Start_Date  End Date  Status
1-Jan-16    31-Dec-16  Active or not

I tried with PHP date("Y-m-d") function but month is an issue.

1 Answer 1

1

You can use the strtotime() function on your excel derived dates and then convert it to a usable DateTime value using date() like so:

$time_before = strtotime('1-Jan-16');
$date_before = date('Y-m-d', $time_before); // 2016-01-01

$time_after  = strtotime('31-Dec-16');
$date_after  = date('Y-m-d', $time_after); // 2016-12-31

Then compare the two dates against each other.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.