Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

How to get local time using PERL?

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
SpaceshipSpaceship
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?
 
Close
0
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
 
Close
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.
 
Close
0
CatchedCatched

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back