Php bir gün öncesi veya sonrası

Php’de tarih işlemleri date fonksiyonuyla kullanılır. Unix zaman damgası için strtotime fonksiyonumuzu kullanacağız. Belirli bir tarihten belirli bir zaman sonrası için iki fonksiyonumuzu da nasıl kullandığımızı inceleyelim.

<?php

// date ( string $format [, int $timestamp = time() ] ) : string
$today = date('Y-m-d H:i:s');


// strtotime ( string $time [, int $now = time() ] ) : int
$tomorrow = date('Y-m-d', strtotime($today . "+1 day"));
$tenDaysAgo = date('Y-m-d H:i:s', strtotime($today . "+10 days"));
$thirtyDaysBefore = date('Y/m/d', strtotime($today . "-30 days"));

 ?>

Join the ConversationLeave a reply

Your email address will not be published. Required fields are marked *

Comment*

Name*

Website

Bu site, istenmeyenleri azaltmak için Akismet kullanıyor. Yorum verilerinizin nasıl işlendiği hakkında daha fazla bilgi edinin.