1. Go to this page and download the library: Download coswat/grapes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
coswat / grapes example snippets
use Coswat\Grapes\Grape;
$time = 169268267; //unix timestamp
//returns 05:38:22
Grape::time($time)->toTime();
//returns 2023-02-27 05:39:09
Grape::time($time)->toRaw();
//returns 2023
Grape::time($time)->toYear();
//returns February
Grape::time($time)->toMonth();
//returns Sunday
Grape::time($time)->toDay();
//returns 5 minutes ago
Grape::time($time)->timeAgo();
//returns nextday timestamp or unix
Grape::time($time)->nextDay();
//returns nextweek timestamp and unix
Grape::time($time)->nextWeek();
//returns nextmonth timestamp and unix
Grape::time($time)->nextMonth();
//returns timestamp of custom dates, for adding day
Grape::time($time)->addDays(3,true);
//returns timestamp of custom dates, for adding weeks
Grape::time($time)->addWeeks(1);
//returns timestamp of custom dates, for adding months
Grape::time($time)->addMonths(3);
$ip = '8.8.8.8'; //ip address
Grape::getTimezone($ip); // returns Asia/Kolkata
$start_time = microtime(true);
// code to run
$end_time = microtime(true);
Grape::getMs($start_time,$end_time); //returns 0.42 ms
Grape::timeDiff(time(),1677625494);
/* will return time difference dynamically
(second,minutes,hours,days) */
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.