1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[CoffeeScript]TwitterAPIのcreated_atからDateオブジェクトを返す関数

Posted at
	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
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?