Skip to content

Instantly share code, notes, and snippets.

@mwiencek
Created March 19, 2018 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwiencek/f3b2da698e219d5ff05a10a2435b4a7a to your computer and use it in GitHub Desktop.
Save mwiencek/f3b2da698e219d5ff05a10a2435b4a7a to your computer and use it in GitHub Desktop.
michael@Michaels-MacBook-Pro-2 ~/c/musicbrainz-server> rlwrap re.pl
$ use DateTime;
$ my $dt = DateTime->new(year => 1966, month => 10, day => 25, hour => 7, minute => 15, second => 47, nanosecond => 500000000, time_zone => 'America/Chicago');
1966-10-25T07:15:47$
$ $dt->strftime('%c') . "\n";
Oct 25, 1966, 7:15:47 AM
$ $dt->strftime('%x') . "\n";
Oct 25, 1966
$ $dt->strftime('%X') . "\n";
7:15:47 AM
$
michael@Michaels-MacBook-Pro-2 ~/c/musicbrainz-server> python3
Python 3.6.4 (default, Mar 9 2018, 23:15:03)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime(2013, 9, 30, 7, 6, 5).strftime('%c')
'Mon Sep 30 07:06:05 2013'
>>> datetime.datetime(2013, 9, 30, 7, 6, 5).strftime('%x')
'09/30/13'
>>> datetime.datetime(2013, 9, 30, 7, 6, 5).strftime('%X')
'07:06:05'
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment