Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is a timezone for domain in expirationDate field? #218

Open
piotrgradzinski opened this issue Mar 4, 2024 · 4 comments
Open

What is a timezone for domain in expirationDate field? #218

piotrgradzinski opened this issue Mar 4, 2024 · 4 comments

Comments

@piotrgradzinski
Copy link

When I'm getting basic information about the domain

<?php
use Iodev\Whois\Factory;

$domainInfo = $whois->loadDomainInfo("domain.com");
var_dump($domainInfo->expirationDate);

within the field expirationDate I'm getting a timestamp, which the I can convert to an object.

My question is, what timezone is used for that timestamp. I assume that the library is not providing this information as I wasn't able to fetch it via whois database. Is there a way to obtain the list of timezones for each domain type?

@dehlirious
Copy link

There is actually a way to get the timezone.

$var = $whois->loadDomainInfo('google.com');

var_dump($var->getExtra()['groups'][0]["Registry Expiry Date"]);

Returns with

string(20) "2028-09-14T04:00:00Z"

Manipulate it via

$dateTime = new DateTime($var->getExtra()['groups'][0]["Registry Expiry Date"]);
$dateTime->setTimezone(new DateTimeZone('America/New_York')); // Convert to New York timezone for example
echo $dateTime->format('Y-m-d H:i:s T'); // Output: 2028-09-13 03:00:00 EDT

@piotrgradzinski
Copy link
Author

@dehlirious thank you very much for the suggestion! It looks like it really depends on the tld - for google.com we can fetch this information, but for example for google.pl I'm not able to find any date with zone information.

@dehlirious
Copy link

@dehlirious thank you very much for the suggestion! It looks like it really depends on the tld - for google.com we can fetch this information, but for example for google.pl I'm not able to find any date with zone information.

Ah, fair enough. Seems the isssue regards the whois server and the lack of information that they provide.

https://www.whois.com/whois/google.pl as an example, the timezone simply isn't given

Also
https://www.whois.com/whois/google.no
https://www.whois.com/whois/google.hk
etc

From that point, I suppose it could be relatively assumed that the timezone is of the country the tld belongs to, from that assumption you could build an array to match these tld's with no timezone info to their respective country.

@bessone
Copy link
Contributor

bessone commented Apr 24, 2024

From my experience not all whois servers declare the timezone, and not all of them use the same one, especially those of registrars.
Some have American time zones and others European ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants