How to fix Verta sample Jalali Laravel problem return object?

You can face this problem while using Verta to convert date and time into the Jalali format to get Iranian Date and Time. You may see this error, i.e. Verta sample Jalali laravel problem return object

Following is the correct implementation of how to return the date and time. If you do not specify format, the variable will always return an object, which will have all information regarding the date and time.

Use the code below, that gives a correct implementation on how to return Iranian date and time. If you won’t specify a format, the variable may always return an object, with all information about the date and time.

$v = verta();
return $v->format('Y-n-j H:i'); // 1395-10-7 14:12
return $v->format('%B %d، %Y'); // دی 07، 1395