we’re a proud nation

/me waves his bullshit flag

So I’m taking my Javascript midterm. No problems. Easy as pie. Talking to Clare online at the same time. then I get to one question on the exam.

“The date object begins on…?”

The two (well, the two most logical of the four) possible answers are January 1st, 1970, and current (local) time

The arguments are these

If you just have these lines in your actual code:

var myTime; //initialize an empty variable
myTime = new Date(); //this fills our empty variable with the default of "Date()"

The contents of “myTime” would be the current time, whenever it is run.

the 1970 bit, on the other hand, is a reference to the way computers in general store time.. that is, they store it as a big ass number. Usually the number of seconds (though sometimes its milliseconds) since January first, 1970. Then whenever the computer is supposed to display the date, it simply does the math. Right now, the date in seconds is: “1103165492” So you’d take that, divide by 60 (seconds in a minute), then divide by 60 (minutes/hour), then divide by 24 (hours/minute), then by 365.4 (days/year) and you get “34.942….” which means 34 years (and some change, almost 35 years) since the epoch – January 1st, 1970.

So, it’s a frame of reference. Like most programming languages, the “Date()” function of JavaScript starts at the beginning of the “epoch”, January 1st, 1970.

So at first I chose the 1970 answer. Being a full on nerd, this answer made the most sense. But then I second guessed myself, and said “well, it does output the actual date…” and picked “current time” – which happened to be wrong.

Long story short, I think the question should have been worded a little differently. So here I wave my bullshit flag, with my 24/25. But hey, at least I’m all done with JS.

Leave a Reply