Megandi
Megandi

Reputation: 104

How to convert Carbon output in laravel

if I use time() the output is integer value like "1458352898" and if i user carbon the output is date type... like here :

$timecarbon = Carbon\Carbon::now("Asia/Hong_Kong");

echo $timestring    //  2016-03-19 09:08:16

$timephp = time("Asia/Hong_Kong")

echo $timephp    //  1458352898

how to use carbon::now, but the output is like time()??

Upvotes: 0

Views: 207

Answers (1)

Can Celik
Can Celik

Reputation: 2087

You should try:

$now = Carbon\Carbon::now("Asia/Hong_Kong");

echo $now->timestamp;

Upvotes: 1

Related Questions