- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
GMT Time in Perl
The function gmtime() in Perl works just like localtime() function but the returned values are localized for the standard Greenwich time zone. When called in list context, $isdst, the last value returned by gmtime, is always 0. There is no Daylight Saving Time in GMT.
You should make a note on the fact that localtime() will return the current local time on the machine that runs the script and gmtime() will return the universal Greenwich Mean Time, or GMT (or UTC).
Try the following example to print the current date and time but on GMT scale −
Example
#!/usr/local/bin/perl $datestring = gmtime(); print "GMT date and time $datestring\n";
Output
When the above code is executed, it produces the following result −
GMT date and time Sat Feb 16 13:50:45 2013
- Related Articles
- Set the base time zone offset to GMT in Java
- Epoch time in Perl
- Java Program to Convert the local Time to GMT
- Current Date and Time in Perl
- Format Date and Time in Perl
- Select current time with MySQL now() and convert it to GMT 0?
- Why do we have a different time zones and why GMT is considered as the standard?
- Comments in Perl
- Whitespaces in Perl
- Dereferencing in Perl
- "Here" Documents in Perl
- Escaping Characters in Perl
- Creating Variables in Perl
- Multiline Strings in Perl
- V-Strings in Perl

Advertisements