Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

How can I get 10 days future date from today in Laravel (PHP)

I'm trying to get a future date from today using PHP.

like date('dS M, Y (D)') returns 21st Jan, 2021 (Thu) (Today)

How can we get a future date from today!

question from:https://stackoverflow.com/questions/65837020/how-can-i-get-10-days-future-date-from-today-in-laravel-php

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could use PHP's DateTime class:

    $dt = new DateTime();
    $dt->modify( '+10 days' );
    echo $dt->format( 'dS M, Y (D)' );

https://www.php.net/manual/en/book.datetime.php


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...