How to find out what the date was 5 days ago? ||
PHP: Calculating past and future dates
|| Code WIth TanveerTo find out what the date was 5 days ago, you can subtract 5 days from the current date. If you're using a programming language, you can typically do this by working with date and time functions. Here's an example using php:
<?php
$days_ago = date('Y-m-d', mktime(0, 0, 0, date("m") , date("d") - 5, date("Y")));
?>
For example: What was 5 days prior to 2008-12-02?
<?php
$days_ago = date('Y-m-d', strtotime('-5 days', strtotime('2008-12-02')));
?>
0 Comments