mercredi 21 juin 2017

How do I check today is between start date and end date using Carbon Laravel?

I have to check whether coupon is active, or no by checking that today is between start date and expired date.

My start date and expired date format is 01/12/2017

Let assume, today is 21/06/2017

Coupon start date is 19/06/2017 and expired date is 23/06/2017

So it should result in Coupon is Active, wheter today is less than coupon start and expired date it should result in Coupon is Expired

So far I didn't find any tutorial which comparing today with start and expired date using Carbon.

Almost all tutorial like this

$now = Carbon::now();

$end_date = Carbon::parse($request->input('end_date'));

$lengthOfAd = $end_date->diffInDays($now);

So How I can check if today is between start date and expired date, and today is less than start date and expired date using Carbon in Laravel?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sSi7yN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire