Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: localtime - make the date format different?

by poolpi (Hermit)
on Dec 22, 2008 at 10:39 UTC ( [id://732032]=note: print w/replies, xml ) Need Help??


in reply to localtime - make the date format different?

#!/usr/bin/perl use strict; use warnings; use File::stat; use DateTime; my $file = '/home/you/test.txt'; my $st = stat($file) or die "No $file: $!"; my $dt = DateTime->from_epoch( epoch => $st->mtime ); print $dt->ymd, ' ', $dt->hms;


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Replies are listed 'Best First'.
Re^2: localtime - make the date format different?
by ikegami (Patriarch) on Dec 22, 2008 at 13:11 UTC
    The OP wanted the local time, so you need to add time_zone => 'local' to the constructor.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://732032]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-20 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found