Log 2661

// Set the values for placeholders
$creationDate = “10/12/2022”; // Example value, replace with actual creation date
$orderDate = “”; // Example value, replace with actual order date
$currentDate = “15/12/2022”; // Example value, replace with actual current date

// Check if the order date is empty
if (empty($orderDate)) {
$daysPassed = calculateDaysPassed($creationDate, $currentDate);
} else {
$daysPassed = calculateDaysPassed($orderDate, $currentDate);
}

return “Number of days passed: ” . $daysPassed;

// Function to calculate the number of days passed between two dates in day/month/year format
function calculateDaysPassed($startDate, $endDate)
{
// Convert dates to timestamps
$startTimestamp = strtotime(str_replace(‘/’, ‘-‘, $startDate));
$endTimestamp = strtotime(str_replace(‘/’, ‘-‘, $endDate));

// Calculate number of seconds between two dates
$secondsDiff = abs($endTimestamp – $startTimestamp);

// Calculate number of days from seconds difference
return floor($secondsDiff / (60 * 60 * 24));
}

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
  • Attributes
  • Custom attributes
  • Custom fields
Click outside to hide the comparison bar
Compare