In my custom module (.module) file, I am using:
$current_time = \Drupal::time()->getCurrentTime();
date_default_timezone_set('GMT');
to get the current date... However, the date value is returned in int A Unix timestamp like: 1556582116
I have tried so far something like:
$current_time = \Drupal::time()->getCurrentTime();
$timenow = $current_time->format('Y-m-d H:i:s');
or
$current_time = \Drupal::time()->getCurrentTime('d');
to get only the day value... but with no success
How can I return the date value in the format of: D/M/Y like: 30/04/2019
or 30/Apr/19