Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. $day = 'Thursday';
  2. $i = 0;
  3. $o_date = new DateTime("2012-09-12 20:56:43 +18 hours");
  4. $date = date_format($o_date, 'l');
  5. $full = date_format($o_date, 'd-m-Y');
  6. if($day!=$date) {
  7. $date = new DateTime($date . " +1 days");
  8. $i++;
  9. }
  10. $order_day = new DateTime($full . " +".$i." days");$order_day = date_format($order_day, 'D, d M');
  11. return $order_day;
  12.  
  13. $day = 'Thursday';
  14. $day_names = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
  15. $day_num = array_search($day, $day_names);
  16. $o_date = new DateTime("2012-09-12 20:56:43 +18 hours");
  17. $o_day_num = $o_date->format('w');
  18. $day_diff = ($day_num - $o_day_num) % 7;
  19. if ($day_diff == 0) { $day_diff = 7; }
  20. $order_day = clone $o_date;
  21. $order_day->add(new DateInterval("P".$day_diff."D"));
  22.  
  23. <?php
  24. $day = 'Thursday';
  25. $i = 0;
  26.  
  27. // Order Date
  28. $o_date = new DateTime("2012-09-12 20:56:43 +18");
  29. $date = $o_date->format('l');
  30.  
  31. while($day!==$date) {
  32. $date = $o_date->add(new DateInterval('P1D'))->format('l');
  33. $i++;
  34. }
  35. $order_day = $o_date->format('D, d M');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement