Read date from csv file using php

Is it possible to check the date range in php. I am storing the data in a csv file and trying to fetch the data in between two dates. But the dates are not getting compared correctly. Please let me is there is a way to do this task in php;

Thanks in advance
Rekha

I reviewed your previous thread on this subject. Your source date format of dd/mm/yy is not understood by strtotime(). You will either need to use a format that is understood (there’s an entire section in the php.net documentation showing what formats are allowed) or you will need to break the fields apart and reassemble them in a format that is understood. Also, in order to compare dates by magnitude, the fields making up each date must be, from left to right, most significant value to least significant value. If you use a php date() format specifier of ‘Y-m-d’, the comparisons will work.

And didn’t anyone learn anything from the Y2K problem, always use 4 digit year values to avoid ambiguity.

If you store your data in a database (which will also require formatting the source dates correctly) getting the data for any report will only take a simple sql query.

Thanks for your reply

Sponsor our Newsletter | Privacy Policy | Terms of Service