简体   繁体   中英

Order now and receive before xxx date (3 days in advance)

I'm creating a new online store and the client has asked for the following, basically a piece of text that says:

Standard delivery: Order now and receive before xxx date (this should be 3 days ahead of the date)

Next day delivery: Order now and receive before xxx date (this should be the following day)

Can anyone point me in the right direction of a script to achieve such?

Many thanks!

$normal=date("d.m.Y",strtotime("+3 days"));
$express=date("d.m.Y",strtotime("+1 day"));

Please remember to set the default timezone.

Live Demo

function pad(str) {
  return ("00"+str).slice(-2);
}
function formatDate(d) {
  return ""+pad(d.getMonth()+1)+"/"+
            pad(d.getDate())+" "+
            d.getFullYear();
}
$(function() {
  var now = new Date(<?php echo time(); ?>*1000);
  now.setDate(now.getDate()+1);
  $("#nextday").text(formatDate(now));
  now.setDate(now.getDate()+2);
  $("#threedays").text(formatDate(now));
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM