Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Can PHP be achieved plus 1.5 years? |
|
Author |
|
spser
Joined: 29 Aug 2016 Posts: 97
|
Posted: Mon 25 Oct '21 10:50 Post subject: Can PHP be achieved plus 1.5 years? |
|
|
$t = strtotime('+1.5 year', time());
Can PHP be achieved plus 1.5 years? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 25 Oct '21 21:03 Post subject: |
|
|
Yes,
Code: |
php -a
Interactive shell
echo strtotime('+1.5 year', time());
1792958568
|
|
|
Back to top |
|
timo
Joined: 03 Jun 2012 Posts: 45 Location: FI, EU
|
Posted: Tue 26 Oct '21 6:59 Post subject: |
|
|
php > echo date("j.n.Y", strtotime("+1.5 year", time()));
26.10.2026
This is 5 years ahead
php > echo date("j.n.Y", strtotime("+18 month", time()));
26.4.2023
This is 1,5 years ahead
In PHP Manual
›Supported Date and Time Formats
›Relative Formats
number format is , no decimal point included. |
|
Back to top |
|
|
|
|
|
|