Created
June 21, 2013 16:18
-
-
Save takuoka/5832362 to your computer and use it in GitHub Desktop.
[CoffeeScript]TwitterAPIのcreated_atからDateオブジェクトを返す関数 ref: http://qiita.com/entotsu@github/items/2fabf9a34d1e0bff620b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newDate_from_tweetCreatedAt = (created_at)-> | |
created_at = created_at.split ' ' | |
# 投稿日時変換 "Mon Dec 01 14:24:26 +0000 2008" -> "Dec 01, 2008 14:24:26" | |
post_date = created_at[1] + " " + created_at[2] + ", " + created_at[5] + " " + created_at[3] | |
# 日時データ処理 | |
date = new Date post_date # 日付文字列 -> オブジェクト変換 | |
date.setHours(date.getHours() + 9) # UTC -> JST (+9時間) | |
return date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment