2013-07-30 9 views
0

내가 Google 웹 로그 분석 쿠키 파서를 통해 일부 비트를 분석하기 위해 노력하고있어,이 있습니다형식 유닉스 타임 스탬프

:Time_of_first_visit__c => Time.new(@data.utma_hash.fetch(:initial_visit_at)).to_datetime.to_formatted_s(:long), 
:Time_of_previous_visit__c => Time.new(@data.utma_hash.fetch(:previous_visit_at)).to_datetime.to_formatted_s(:long), 
:Current_visit_time__c => Time.new(@data.utma_hash.fetch(:current_visit_at)).to_datetime.to_formatted_s(:long), 

그러나이 같은 렌더링 것 : 첫 번째 방문 의

시간 년 1 월 1 일 1,375,174,064 0시

현재 방문 시간 년 1 월 1 일 이전 V의 1375174064 0시

시간 당신의 언어 물론 당신이 날짜 형식의 사양을 필요

I18n.l Time.new(@data.utma_hash.fetch(:initial_visit_at)).to_datetime 

: to_formatted_s(:long)를 제거하고 I18n.l

예 인수로 사용하는 isit 하 년 1 월 1 일 1,375,174,064 0시

답변

0

이것은 내가 결국 사용했던 코드입니다.

:Time_of_first_visit__c => Time.at(@data.utma_hash.fetch(:initial_visit_at).to_i + 1.hour).strftime("%B %e, %Y at %I:%M %p"), 
:Time_of_previous_visit__c => Time.at(@data.utma_hash.fetch(:previous_visit_at).to_i + 1.hour).strftime("%B %e, %Y at %I:%M %p"), 
:Current_visit_time__c => Time.at(@data.utma_hash.fetch(:current_visit_at).to_i + 1.hour).strftime("%B %e, %Y at %I:%M %p"), 
0

시도. yml 파일이지만 공식 가이드에서 찾을 수있는 기본 파일과 함께 사용해야합니다.