michaelmcgurk
michaelmcgurk

Reputation: 6509

DateTime issue with PHP - Storing Specific Date

I'd like to be able to store the following data inside a variable: 'Current Year-Current Month-10' (so i.e. 2013-9-10)

Currently, I'm using: echo date("Y-m-d");

But this (as expected) displays the current Day, not 10 as I need it to.

Any help with this would be great.

Upvotes: 0

Views: 61

Answers (3)

xdazz
xdazz

Reputation: 160923

You just need to do:

echo date("Y-m-10");

If you want next month:

echo date('Y-m-10', strtotime('next month'));

Upvotes: 5

lampwins
lampwins

Reputation: 920

Try this:

$var = date("Y-m-10");

Upvotes: 1

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100195

if you mean you want to hard code 10, then you could do:

$date = date("Y-m")."-10";

Upvotes: 4

Related Questions