Skip to content

Instantly share code, notes, and snippets.

@beepony
Created May 28, 2016 14:30
Show Gist options
  • Save beepony/82d94967fcf3fd111af8add55ee6acb6 to your computer and use it in GitHub Desktop.
Save beepony/82d94967fcf3fd111af8add55ee6acb6 to your computer and use it in GitHub Desktop.
%a - The abbreviated weekday name (Sun) 缩写的星期
%A - The full weekday name (Sunday)
%b - The abbreviated month name (Jan) 缩写的月份
%B - The full month name (January)
%d - Day of the month (01..31)
%e - Day of the month (1..31)
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%l - Hour of the day ()
%j - Day of the year (001..366)
%m - Month of the year (01..12)
%M - Minute of the hour (00..59)
%p - Meridian indicator (AM or PM)
%S - Second of the minute (00..60)
%w - Day of the week (Sunday is 0, 0..6)
%y - Year without a century (00..99)
%Y - Year with century
%Z - Time zone name
%% - Literal % character
@beepony
Copy link
Author

beepony commented May 28, 2016

"Date: <Wed, 29 Oct 2014 02:26:58 GMT>"
Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S GMT")

@beepony
Copy link
Author

beepony commented Jun 3, 2016

utc 时间转换成北京时间

Time.at(1464938310) = 2016-06-03 15:18:30 +0800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment