Advertisement
Guest User

Untitled

a guest
Feb 7th, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. $ TZ=America/New_York perl -e'
  2. use strict;
  3. use warnings;
  4.  
  5. use DateTime qw( );
  6. use POSIX qw( strftime );
  7. use Time::Piece qw( localtime );
  8. use Time::Seconds qw( ONE_HOUR );
  9.  
  10. my $epoch = 1583683200; # 2020-03-08T12:00:00
  11.  
  12. CORE::say
  13. for
  14. DateTime->from_epoch( epoch => $epoch, time_zone => $ENV{TZ} )->subtract( hours => 12 ),
  15. strftime("%FT%T", localtime($epoch - 12*60*60)),
  16. ( localtime($epoch) - 12*ONE_HOUR )->strftime("%FT%T");
  17. '
  18. 2020-03-07T23:00:00
  19. 2020-03-07T23:00:00
  20. 2020-03-07T23:00:00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement