Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get yesterday date in php

echo date("Y-m-d", strtotime("yesterday")); 
Comment

check if given date time is of today or yesterday php

function getRangeDateString($timestamp) {
    if ($timestamp) {
        $currentTime=strtotime('today');
        // Reset time to 00:00:00
        $timestamp=strtotime(date('Y-m-d 00:00:00',$timestamp));
        $days=round(($timestamp-$currentTime)/86400);
        switch($days) {
            case '0';
                return 'Today';
                break;
            case '-1';
                return 'Yesterday';
                break;
            case '-2';
                return 'Day before yesterday';
                break;
            case '1';
                return 'Tomorrow';
                break;
            case '2';
                return 'Day after tomorrow';
                break;
            default:
                if ($days > 0) {
                    return 'In '.$days.' days';
                } else {
                    return ($days*-1).' days ago';
                }
                break;
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: php variable in echo 
Php :: get unique array from multidimentional array by value in php 
Php :: laravel with callback 
Php :: hide all error in php 
Php :: laravel npm run dev mix error FIX 
Php :: laravel return response view 
Php :: template literals php 
Php :: filter child table data from parent laravel eloquent 
Php :: woocommerce order item get product id 
Php :: json encode decode php 
Php :: ?? ternary operator in php 
Php :: wordpress display post categories 
Php :: laravel check environment hlper 
Php :: PHP Display Posts by Category in WordPress 
Php :: laravel exist 
Php :: php array order alphabetically 
Php :: how to print string plus variable in php 
Php :: Adding JavaScript to a Specific WordPress Page Using Code In Header 
Php :: how to build laravel database 
Php :: laravel get age from date 
Php :: laravel restrict route methods 
Php :: how naming resource routes laravel 
Php :: laravel collective form include image 
Php :: model hasmany laravel 
Php :: php order filename 
Php :: how make a variable global php 
Php :: laravel enable mysql logging 
Php :: laravel create controller 
Php :: get filesize php 
Php :: insertion sort in php 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =