Longman\TelegramBot\Commands\UserCommands\DateCommand::getFormattedDate PHP Method

getFormattedDate() private method

Get formatted date at the passed location
private getFormattedDate ( string $location ) : string
$location string
return string
    private function getFormattedDate($location)
    {
        if ($location === null || $location === '') {
            return 'The time in nowhere is never';
        }
        list($lat, $lng) = $this->getCoordinates($location);
        if (empty($lat) || empty($lng)) {
            return 'It seems that in "' . $location . '" they do not have a concept of time.';
        }
        list($local_time, $timezone_id) = $this->getDate($lat, $lng);
        $date_utc = new DateTime(gmdate('Y-m-d H:i:s', $local_time), new DateTimeZone($timezone_id));
        return 'The local time in ' . $timezone_id . ' is: ' . $date_utc->format($this->date_format);
    }