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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.