The mktime()
returns the Unix time stamp of the given argument. The result time stamp contains the number of seconds between the unix time stamp (January 1 1970 00:00:00 GMT) and the that date. If you will not provide any arguments then value will be set to the current value according to the local date and time.
On success mktime()
function return the Unix Timestamp otherwise if any argument is invalid it will return FALSE.
mktime(hour,minute,second,month,day,year,is_dst)
Parameter | |
---|---|
hour | Optional. Specifies the hour |
minute | Optional. Specifies the minute |
second | Optional. Specifies the second |
month | Optional. Specifies the numerical month |
day | Optional. Specifies the day |
year | Optional. Specifies the year. |
is_dst | Optional. Set this parameter to 1 if the time is during daylight savings time (DST), 0 if it is not, or -1 (the default) if it is unknown. |
You can also check other recommended Date PHP tutorials,
<?= $mysql_datetime = date('Y-m-d H:i:s',$timestamp); ?>
The code below covers the period from January 1st to 00:00:00 today:
<?= $startTime = mktime(0, 0, 0, 1, 1, date('Y')); $endTime = mktime();
The below code covers date between from January 1, at 00:00:00 to 31 December at 23:59:59:
<? $startTime = mktime(0, 0, 0, 1, 1, date('Y')-1); $endTime = mktime(23, 59, 59, 12, 31, date('Y')-1); ?>
The below code covers the period between from the first day of the current Month to now:
<? $startTime = mktime(0, 0, 0, date('m'), 1, date('Y')); $endTime = mktime(); ?>
The code below covers the period from 30 days ago to now:
<? $ starttime = mktime () - 30 * 3600 * 24; $ endTime = mktime (); ?>
I will assumes the first day of the week is Monday. It covers the period from Monday morning at 00:00:00 to now:\
<? $startTime = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24); $endTime = mktime(); ?>
Below code covers the period from the Monday at 00:00:00 to the following Sunday at 23:59:59:
<? $startTime = mktime(0, 0, 0, date('n'), date('j')-6, date('Y')) - ((date('N'))*3600*24); $endTime = mktime(23, 59, 59, date('n'), date('j'), date('Y')) - ((date('N'))*3600*24); ?>
The code below covers the past 24 hours so far:
<?php $startTime = mktime() - 24*3600; $endTime = mktime(); ?>
Below covers the period from yesterday at 00:00:00 to 23:59:59 yesterday:
<?php $startTime = mktime(0, 0, 0, date('m'), date('d')-1, date('Y')); $endTime = mktime(23, 59, 59, date('m'), date('d')-1, date('Y')); ?>
This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More
in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More
This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More
We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More
in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More
I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More
View Comments
i need the biggest mktime from the list of mk time..
have u code regarding above..
below is mktime i need biggest from them using query or mktime syntax
1365987661
1365728461
1365728461
1365728461
1365728461
1365814861
1365814861
1365814861
1365814861
1365814861
you can sort them,then you will use limit parameters with in query.