#!/usr/bin/perl -w use strict; use warnings; use DateTime; my @filestats = stat '/etc/fstab'; my $atime = $filestats[8]; my $mtime = $filestats[9]; my $ctime = $filestats[10]; print "atime als epochtime = $atime atime im gewuenschten format new = ",convert_epochtime($atime),"\n"; print "mtime als epochtime = $mtime atime im gewuenschten format new = ",convert_epochtime($mtime),"\n"; print "ctime als epochtime = $ctime atime im gewuenschten format new = ",convert_epochtime($ctime),"\n"; sub convert_epochtime { my $epochtime = shift; my $dt = DateTime->from_epoch( epoch => $epochtime ); my $newtimeformat = $dt->ymd; $newtimeformat .= '_'; $newtimeformat .= $dt->hms; return ($newtimeformat); } 1;