Dynadot โ€” .com Transfer

How to get local time using PERL?

SpaceshipSpaceship
Watch
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
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
•••
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
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back