@php use Carbon\Carbon; $currentDateTime = Carbon::now('Asia/Dhaka'); // Set the timezone to "Asia/Dhaka" for $givenDateTime $givenDateTime = Carbon::parse($endTime, 'Asia/Dhaka'); // Calculate the time difference $timeDifference = $currentDateTime->diff($givenDateTime)->format('%d days, %h hours, %I minutes, %S seconds'); // Explode the formatted time difference string into an array $timeDifferenceArray = explode(', ', $timeDifference); // Initialize an associative array to hold the time difference values $timeDifferenceAssoc = []; // Iterate through the exploded array and split the key-value pairs foreach ($timeDifferenceArray as $difference) { $pair = explode(' ', $difference, 2); $timeDifferenceAssoc[$pair[1]] = (int)$pair[0]; } // Convert associative array to JSON $timeDifferenceJson = json_encode($timeDifferenceAssoc); @endphp @if(strtotime($givenDateTime) > strtotime($currentDateTime))

Day Counter

35 Days
17 Hours
50 Minutes
39 Seconds
@endif
@csrf

Add Flash Sale