Dynadot Black Friday and Cyber Monday 2026: save more on domains. See our sales.

How to get local time using PERL?

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

pzqwpo

New Member
Impact
0
How to get local time using PERL while the server I am using is in a different time zone? For example, my local time is 9 am August 17th. But the server is in 9pm August 16th time zone. How do I write PERL code to get my local time?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
How to get local time using PERL while the server I am using is in a different time zone? For example, my local time is 9 am August 17th. But the server is in 9pm August 16th time zone. How do I write PERL code to get my local time?

Have you tried using:

Code:
localtime(time);
?

E.g:

Code:
#!/usr/local/bin/perl
@time = localtime(time);
print join('',@time);

-RageD
 
0
Close
Perl uses the TZ environmental variable to determine which timezone to use. Try adding the following to the top of the script:

Code:
$ENV{TZ}="UTC";

Set "UTC" to your timezone. Use timeanddate.com to work out the timezone for your location.
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back