如何声明函数的日期特定值

如何声明函数的日期特定值

问题描述:

from this use example:

echo time_elapsed_string('2013-05-01 00:22:35', true);

from this Converting timestamp to time ago in PHP e.g 1 day ago, 2 days ago...

it must write exactly the date '2013-05-01 00:22:35'

now, i want to take date from this data in red box: enter image description here which i succeed if i write it like this:

<h4>di posisi sekarang:<br> <?php echo $row["tanggal"];  ?></h4><br>

but when i used it like this:

echo time_elapsed_string('<?php echo $row["tanggal"];  ?>', true);

it doesn't work, how do i get the data right?

来自此用例的

: strong> p>

  echo time_elapsed_string('2013-05-01 00:22:35',true); 
  code>  pre> 
 
 

来自将时间戳转换为PHP时间,例如1天前,2天 之前...... p>

它必须准确写出日期'2013-05-01 00:22:35' code> p>

现在,我想从红色框中的数据中取出日期: 如果我这样写的话,我会成功: p> &lt; h4&gt; di posisi sekarang:&lt; br&gt; &lt;?php echo $ row [“tanggal”]; ?&gt;&lt; / h4&gt;&lt; br&gt; code> pre>

但当我像这样使用它时: p>

  echo time_elapsed_string('&lt;?php echo $ row [“tanggal”];?&gt;',true); 
  code>  pre> 
 
 

它不起作用,如何 我能获得正确的数据吗? p> div>

You are trying to write PHP inside a PHP string. Just remove PHP tags and echo:

echo time_elapsed_string($row["tanggal"], true);

In your context:

<h4>di posisi sekarang:<br> 
    <?php echo time_elapsed_string($row["tanggal"], true);  ?>
</h4><br>