How can I get the timestamp of 12 o'clock of today, yesterday and the day before yesterday by using strtotime() function in php?
12 o'clock is a variable and would be changed by user.
How can I get the timestamp of 12 o'clock of today, yesterday and the day before yesterday by using strtotime() function in php?
12 o'clock is a variable and would be changed by user.
Due to a daylight savings shift, 28/10/12 has an extra hour in your timezone. There are 25 hours between midnight 28/10 and midnight 29/10.
You will also find a day with 23 hours in spring.
If this is not what you expect, change the timezone to something that has no DST. UTC is one option:
php > echo mktime(0,0,0,10,29,2012) - mktime(0,0,0,10,28,2012);
90000
php > ini_set('date.timezone', 'UTC');
php > echo mktime(0,0,0,10,29,2012) - mktime(0,0,0,10,28,2012);
86400
The last one should be gmdate
instead of date
:
'<b>Time difference::</b> ' . gmdate('h:i:s', $time_diff);
date
adjusts for your current locale, which appears to be GMT+1. gmdate
does not make that adjustment.
I'm assuming that you're only planning to use this for time differences less than 24 hours.
I understand the question and the answer is going to be complex. First you need to add onChange event to your ProducerType selectbox. Add this at the end of your html:
<script>
$(document).ready(function(){
// attach event on change
$('#ProducerType').on('change',function(){
// call script on server to check if isset() and receive values for Role
$.get("checkproducer.php?ProducerType="+$('#ProducerType').val(),function(result){
// here the script on server returned data already
// update Role selectbox with new values
$('#Role').html(result)
})
})
})
</script>
Make sure you have jquery.js loaded as usual.
You will need to create a PHP script on server which handles the check and returns new data for your select input. Like this (save as "checkproducer.php"):
<?php
if ($_GET['ProducerType']=="Principal")
echo "<option value=1>Principal1</option>"
."<option value=2>Principal2</option>";
if ($_GET['ProducerType']=="Producer")
echo "<option value=1>Producer1</option>".
."<option value=2>Producer2</option>";
if ($_GET['ProducerType']=="SoleProprietor")
echo "<option value=1>SoleProprietor1</option>"
."<option value=2>SoleProprietor2</option>";
// etc
?>
getID3 supports video formats. See: http://getid3.sourceforge.net/
Edit: So, in code format, that'd be like:
include_once('pathto/getid3.php');
$getID3 = new getID3;
$file = $getID3->analyze($filename);
echo("Duration: ".$file['playtime_string'].
" / Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall".
" / Filesize: ".$file['filesize']." bytes<br />");
Note: You must include the getID3 classes before this will work! See the above link.
Edit: If you have the ability to modify the PHP installation on your server, a PHP extension for this purpose is ffmpeg-php. See: http://ffmpeg-php.sourceforge.net/