php mysql want to add 30 days from a feild [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i want to add 30 days from the date $first and the result in $sec to take the data between these days from MySQL
$first=05/02/2014
result as in
$sec= 06/02/2014 in m/d/y format
thank you

try
echo $sec=date('m/d/y',strtotime('+30 days', time($first))); //06/04/14

Related

PHP convert integer to time [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How can I convert integer to time in minutes e.g. 5 would give 30mins. I've tried
<?php
$toMin = 5;
echo date('i', ($toMin*60)).'mins';
?>
But it only returns 05mins
so something like:
$time='7.5'; //, 8.3, 2.2.
$x=explode('.',$time);
$min=60*($x[1]/10);
echo $x[0] .'hours and '.$min.'mins';

Calculate remaining days of leave - php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Say:
The start day is January 5 and the end is January 10 and the current date is January 7. I want to output the remaining days which is 3.
I think the easiest method is like this.
$date1 = new DateTime("2015-01-01");
$date2 = new DateTime("2010-02-05");
$diff = $date2->diff($date1)->format("%a");

I want php date formate in yyyy-mm-ddThh:mm:ss:ss.sssz. How to write code for this? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Please help me to find the current date in the following formate yyyy-mm-ddThh:mm:ss:ss.sssz
<?php
$t = microtime(true);
$micro = sprintf("%03d",($t - floor($t)) * 1000);
$utc = gmdate('Y-m-d\TH:i:s.', $t).$micro.'Z';
echo $utc;
?>
DEMO

Strange difference between formatted date and original date [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I tried to get events from google calendar. So I have trouble in time output.
$date = DateTime::createFromFormat("Y-m-d\TH:m:sP", "2013-02-12T21:00:00-05:00");
echo $date->format('H:m');
Output is 21:12, but it should be 21:00. How it can be fixed?
m is months. You're looking for minutes which is i:
$date = DateTime::createFromFormat("Y-m-d\TH:i:sP", "2013-02-12T21:00:00-05:00");
echo $date->format('H:i');

time conversion zendframework integer to time php [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i have time in a format of an integer example:(454 seconds) and i need to convert it to a time format example:(00:07:34) any function can help me to do this??
You can do it using Zend_Date:
$time = new Zend_Date();
$time->setTime('00:00:00');
$time->addSecond(454);
echo $time->toString('HH:mm:ss'); // result 00:07:34

Categories