# File basiclibrary.rb, line 303
  def custom_format(formatString)
    zYY   = (zYYYY=self.year.to_s)[-2..-1]
    zMM   = (zM=self.mon)<10 ? ('0'+zM.to_s) : zM.to_s
    zMMM  = (zMMMM=MONTH_NAMES[zM-1])[0...3]
    zDD   = (zD=self.day)<10 ? ('0'+zD.to_s) : zD.to_s
    zDDD  = (zDDDD=DAY_NAMES[wday])[0...3]
    zth   = (zD>=10&&zD<=20) ? 'th' : ((dMod=zD%10)==1) ? 'st' : (dMod==2) ? 'nd' : (dMod==3) ? 'rd' : 'th'
  
    zh    = (zhhh=self.hour)==0 ? 24 : zhhh; zh-=12 if (zh>12)
    zhh   = zh<10 ? ('0'+zh.to_s) : zh.to_s
    zmm   = (zm=self.min)<10 ? ('0'+zm.to_s) : zm.to_s
    zss   = (zs=self.sec)<10 ? ('0'+zs.to_s) : zs.to_s
    zAMPM = (zampm=zhhh<12 ? 'am' : 'pm').upcase

    f=formatString
    f.gsub!(/#YYYY#/,zYYYY);f.gsub!(/#YY#/,zYY);f.gsub!(/#MMMM#/,zMMMM);f.gsub!(/#MMM#/,zMMM);f.gsub!(/#MM#/,zMM.to_s);f.gsub!(/#M#/,zM.to_s);f.gsub!(/#DDDD#/,zDDDD);f.gsub!(/#DDD#/,zDDD);f.gsub!(/#DD#/,zDD);f.gsub!(/#D#/,zD.to_s);f.gsub!(/#th#/,zth);f.gsub!(/#hhh#/,zhhh.to_s);f.gsub!(/#hh#/,zhh);f.gsub!(/#h#/,zh.to_s);f.gsub!(/#mm#/,zmm);f.gsub!(/#m#/,zm.to_s);f.gsub!(/#ss#/,zss);f.gsub!(/#s#/,zs.to_s);f.gsub!(/#ampm#/,zampm);f.gsub!(/#AMPM#/,zAMPM);f
  end