Unlike Blake Sterzinger, not everyone is willing to own up to a software development mistake they've made, especially knowing full well that their mistake could be posted on this blog for all to see.

I came across this a little while ago when a client asked for some enhancements. No one else wanted to touch this, so it was all on me. Fair enough. After all, I did write it a few years back when making the transition from purely client-side HTML/Javascript to ASP/IIS/SQL ...

Too lazy to look up the information or ask for help, I stored all dates/times in the server as plain text. When I realized that returning rows ordered by alphabetized dates (e.g. 11/1/2004 comes between 1/31/2004 and 2/1/2004) wasn't going to make the users very happy, I switched to a plain text means of storing information that would return things in the appropriate order when alphabetized (as long as the time was between 3/12/1973 and 12/18/2084):

//  GOOFY TIME SCHEME. TAKES IN TIME, ROUNDS TO NEAREST SECOND, CONVERTS DATE/TIME STAMP
//  TO BASE 36 NUMBER - NUMBER OF SECONDS SINCE 1/1/1970 0:00:00 GMT
function timeIn(dstr){
  var newDate=(dstr)?new Date(dstr):new Date();
  return Math.round(newDate.valueOf()/60000).toString(36);
}

//  KICKS OUT MM/DD/YYYY HH:MM, TAKING INTO ACCOUNT USER'S OFFSET FROM SERVER.
var tOff=(!isNaN(Request.cookies('tOff')))?Number(Request.cookies('tOff')):60;
function timeOut(v){
  var d=new Date(parseInt(v,36)*60000);
  d.setMinutes(d.getMinutes()+tOff);
  return  
    (
      (d.getMonth()>8)?(d.getMonth()+1):'0'+(d.getMonth()+1))+
      '/'+((d.getDate()>9)?d.getDate():'0'+d.getDate())+
      '/'+d.getFullYear()+
      ' '+((d.getHours()>9)?d.getHours():'0'+d.getHours())+
      ':'+((d.getMinutes()>9)?d.getMinutes():'0'+d.getMinutes()
    );
}

Of course, I'd be the first to admit to my own mistake. I'm still waiting for that day to come.  If it ever does, you'll here it first from me. And if you're wondering about some old code, messages, etc. that seem a bit off, that was actually from another guy. With the same name. Who worked at the same place. And the other same place. Yes, that did get a bit weird.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!