Dynadot โ€” .com Registration $8.99

How to get local time using PERL?

Spaceship Spaceship
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 DomainsUnstoppable Domains
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 Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back