Skip to content

Instantly share code, notes, and snippets.

@sharkpp
Last active May 28, 2016 13:39
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 sharkpp/7f45f212b1d58609bf7ee19164630452 to your computer and use it in GitHub Desktop.
Save sharkpp/7f45f212b1d58609bf7ee19164630452 to your computer and use it in GitHub Desktop.
# The MIT License (MIT)
# Copyright (c) 2016 sharkpp.
# See: https://opensource.org/licenses/mit-license.php
t = Time.at(ARGV[0].to_i);
# http://docs.ruby-lang.org/ja/2.2.0/method/Time/i/strftime.html
[
'%A',
'%a',
'%B',
'%b',
'%C',
'%c',
'%D',
'%d',
'%e',
'%F',
'%H',
'%h',
'%I',
'%j',
'%k',
'%L',
'%l',
'%M',
'%m',
'%n',
'%N',
'%6N',
'%3N',
'%P',
'%p',
'%R',
'%r',
'%S',
'%s',
'%T',
'%t',
'%U',
'%u',
'%v',
'%V',
'%W',
'%w',
'%X',
'%x',
'%Y',
'%y',
'%Z',
'%z',
'%:z',
'%::z',
'%%',
# ほかの言語と同様に出力できるフォーマット
'%-e',
'%-m',
'%-H',
'%-l',
'%FT%T%:z',
'%a, %d %b %Y %T %z',
'%#P',
].each {
|fmt|
print fmt + '@@' + t.strftime(fmt) + '@~';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment