Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. # ローカル時刻の取得
  4. ($sec, $min, $hour, $day, $mon, $year, $wday) = localtime; # ローカル時刻の各種値をリストで受け取る.
  5. $yearstr = $year + 1900; # 1900を足すことで$yearの文字列版$yearstrをセット.
  6. $monstr = $mon + 1; # 1を足すことで$monの文字列版$monstrをセット.
  7. $wdaystr = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")[$wday]; # リストの添字を使って$wdayの文字列版$wdaystrをセット.
  8. print "$yearstr/$monstr/$day $hour:$min:$sec ($wdaystr)\n"; # ローカル時刻文字列の出力.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement