File "localdates.min.js"

Path: /ThinkIB/chem/js/localdatesminjs
File size: 1.14 KB
MIME-type: text/plain
Charset: utf-8

 
Open Back
var localdate=new Date;function format_date(unixTime,format){var halfMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fullMonths=["January","February","March","April","May","June","July","August","September","October","November","December"];"string"!=typeof format&&(format="d M y"),localdate.setTime(unixTime);for(var n=localdate.getMonth(),Y=localdate.getFullYear(),out="",i=0;i<format.length;i++)switch(format[i]){case"j":out+=localdate.getDate();break;case"d":out+=String("00"+localdate.getDate()).slice(-2);break;case"n":out+=n+1;break;case"m":out+=String("00"+(n+1)).slice(-2);break;case"M":out+=halfMonths[n];break;case"F":out+=fullMonths[n];break;case"y":out+=String("00"+Y).slice(-2);break;case"Y":out+=Y;break;case"H":out+=String("00"+localdate.getHours()).slice(-2);break;case"i":out+=String("00"+localdate.getMinutes()).slice(-2);break;case"s":out+=String("00"+localdate.getSeconds()).slice(-2);break;default:out+=format[i]}return out}function update_local_dates(parent_element){parent_element.find("span.localdate").each((function(){$(this).text(format_date(1e3*parseInt($(this).data("time")),$(this).data("format")))}))}