Jump to content

[SOLVED] Date produce


timmah1

Recommended Posts

Hi

 

How would I take this code

$start = date("Y-m-d");
$formatted_date = date("M j, Y", strtotime($start));

And make it echo 3 days ahead?

 

Meaning, today's date is Jan. 15, 2008,  I would like this code to be able to distinguish 3 days ahead, meaning it would echo out Jan. 18, 2008.

 

I've tried this, but it only shows the 3

$start = date("Y-m-d");
$formatted_date = date("M j, Y", strtotime($start));
$ends = $formatted_date+3;

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/86151-solved-date-produce/
Share on other sites

your version of php doesn't support a start date in that format so try (the yyyy-mm-dd)

so try

<?php
$start = date("U");
$formatted_date = date("M j, Y", strtotime("+3 Days", $start));
echo "Start: ".$start."<br />Formatted: ".$formatted_date;
?>

 

really if you are strating at NOW() you can ignore the start and just do

<?php
$formatted_date = date("M j, Y", strtotime("+3 Days"));
echo "Formatted: ".$formatted_date;
?>

Link to comment
https://forums.phpfreaks.com/topic/86151-solved-date-produce/#findComment-439985
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.