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';
Related
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 7 years ago.
Improve this question
I got these arrays
$address = array("1JzSZFs2DQke2B3S4pBxaNaMzzVZaG4Cqh", "12Cf6nCcRtKERh9cQm3Z29c9MWvQuFSxvT", "1dice6YgEVBf88erBFra9BHf6ZMoyvG88")
$amount= array("100000000","150000000","200000000")
and I want to convert them to json format like below:
{
"1JzSZFs2DQke2B3S4pBxaNaMzzVZaG4Cqh": 100000000,
"12Cf6nCcRtKERh9cQm3Z29c9MWvQuFSxvT": 1500000000,
"1dice6YgEVBf88erBFra9BHf6ZMoyvG88": 200000000
}
I tried too much but couldn't figure out how to do that in PHP, any ideas?
Use array_combine:
echo json_encode(array_combine($address, array_map('intval', $amount)));
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
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
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');
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