Announcement

Collapse
No announcement yet.

Convert weekday into actual date

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert weekday into actual date

    Hi,

    I want to convert a week day into date. For eg. Friday in this week to 11/9/2015. Any help would be appreciated.

  • #2
    Hi Emma,

    Try using strtotime() for this -
    function dayDate($day) {
    return date('m-d-Y', strtotime('next ' . $day));
    }

    Comment


    • #3
      The other alternative is as follows -
      <?php

      $myDate = new DateTime("Next Tuesday", new DateTimeZone("America/Detroit"));

      echo $myDate->format("Y-m-d") . "<br>\n";

      Comment

      Working...
      X