Kodama's home / tips.
入力: 調べたい時刻を入力します. (書式例: Feb 07 00:00:00 2007, 2007 Feb 07 00:00:00 など)
結果:
現在の時刻:
$ date +"%s" 1170604923 $ ruby -e 'p Time.now.to_i' 1170604923 $ gawk 'BEGIN{print systime();exit}' 1170604923 $ perl -e 'print time,"\n"' 1170604923
$ date -d '2007/2/5 01:02:03' +'%s' 1170604923 $ ruby -e 'require "time";t=Time.parse("2007/2/5 01:02:03"); p t.to_i' 1170604923 $ ruby -e 'require "time";t=Time.parse("2007/2/5 01:02:03 JST"); p t.to_i' 1170604923 $ ruby -e 'require "time";t=Time.parse("2007/2/5 01:02:03 UTC"); p t.to_i' 1170637323
$ ruby -e 'p Time.at(1170604923)' Mon Feb 05 01:02:03 JST 2007 $ ruby -e 't=Time.at(1170604923); p t.utc; p t.localtime' Sun Feb 04 16:02:03 UTC 2007 Mon Feb 05 01:02:03 JST 2007 $ ruby -e 'p Time.at(1170604923).strftime("%Y/%m/%d %H:%M:%S")' "2007/02/05 01:02:03" $ gawk 'BEGIN{print strftime("%c",1170604923);exit}' Mon Feb 5 01:02:03 2007 $ gawk 'BEGIN{print strftime("%Y/%m/%d %H:%M:%S",1170604923);exit}' 2007/02/05 01:02:03 $ perl -e '@t=localtime(1170604923);printf("%d/%02d/%02d %02d:%02d:%02d\n",@t[5]+1900,@t[4]+1,@t[3],@t[2],@t[1],@t[0])' 2007/02/05 01:02:03
Kodama's home / tips.