lib/vmdb/global_methods.rb
# Had to add timezone methods here, they are being called from models
# returns formatted time in specified timezone and format
Had to add timezone methods here, they are being called from models
returns formatted time in specified timezone and format
Had to add timezone methods here they are being called from models returns formatted time in specified timezone and format
def format_timezone(time, timezone = Time.zone.name, ftype = "view")
      timezone = timezone.name if timezone.kind_of?(ActiveSupport::TimeZone)   
      if !time.blank?
        new_time = time.in_time_zone(timezone)
        case ftype
        when "gtl"                                  
          new_time = new_time.strftime("%m/%d/%y %H:%M:%S %Z")
        when "on_at"                                  
          new_time = new_time.strftime("on %m/%d/%y at %H:%M:%S %Z")
        when "fname"                                
          new_time = new_time.strftime("%Y_%m_%d")
        when "date"                                 
          new_time = new_time.strftime("%m/%d/%y")
        when "datetime"                             
          new_time = new_time.strftime("%m/%d/%y %H:%M:%S")
        when "export_filename", "support_log_fname"    
          new_time = new_time.strftime("%Y%m%d_%H%M%S")
        when "tl"
          new_time = new_time.strftime("%a %b %d %Y %H:%M:%S") + " " + Time.zone.to_s
          new_time = new_time.gsub(/\) [a-zA-Z0-9\s\S]*/, ")")
        when "raw"                                  
        when "compare_hdr"                          
          new_time = new_time.strftime("%m/%d/%y %H:%M %Z")
        when "widget_footer"                        
          new_time = new_time.strftime("%m/%d/%y %H:%M")
        else                                        
          new_time = new_time.strftime("%a %b %d %H:%M:%S %Z %Y")
        end
      else    
        new_time = ""
      end
      new_time
    end
def format_timezone ( time , timezone = Time . zone . name , ftype = "view" ) timezone = timezone . name if timezone . kind_of? ( ActiveSupport :: TimeZone ) if ! time . blank? new_time = time . in_time_zone ( timezone ) case ftype when "gtl" new_time = new_time . strftime ( "%m/%d/%y %H:%M:%S %Z" ) when "on_at" new_time = new_time . strftime ( "on %m/%d/%y at %H:%M:%S %Z" ) when "fname" new_time = new_time . strftime ( "%Y_%m_%d" ) when "date" new_time = new_time . strftime ( "%m/%d/%y" ) when "datetime" new_time = new_time . strftime ( "%m/%d/%y %H:%M:%S" ) when "export_filename" , "support_log_fname" new_time = new_time . strftime ( "%Y%m%d_%H%M%S" ) when "tl" new_time = new_time . strftime ( "%a %b %d %Y %H:%M:%S" ) + " " + Time . zone . to_s new_time = new_time . gsub ( / \)  [a-zA-Z0-9 \s \S ]* / , ")" ) when "raw" when "compare_hdr" new_time = new_time . strftime ( "%m/%d/%y %H:%M %Z" ) when "widget_footer" new_time = new_time . strftime ( "%m/%d/%y %H:%M" ) else new_time = new_time . strftime ( "%a %b %d %H:%M:%S %Z %Y" ) end else new_time = "" end new_time end
Had to add timezone methods here, they are being called from models
returns formatted time in specified timezone and format
Had to add timezone methods here they are being called from models returns formatted time in specified timezone and format
# If a Timezone object comes in, just get the name # for gtl views # for gtl views # for download filename # for just mm/dd/yy # mm/dd/yy hh:mm:ss # for export/log filename # return without formatting # for drift/compare headers # for widget footers # for summary screens # if time is nil
time
<not_specific>
timezone
<not_specific>
zone
<not_specific>
name
<not_specific>
ftype
<not_specific>