Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js
Transportation and, most especially, communication improvements have contributed to this effect. Now we can answer the phone and talk to the friend who has called for a while without worrying too much about the distance or cost associated with the call. Gone are the days when long distance calls were so expensive that you almost had to plan out each sentence you'd say before you picked up the phone! But: when the conversation has been going on for a little while and your friend asks "what's the time now?" you have to think for a moment whether they mean where you are, where they are or whether that makes a difference anyway. Throw the Web into the mix and you suddenly have to remember that's its full name begins with "World Wide".
A conscientious web designer, such as yourself, would always remember that they don't know where their audience is. To meaningfully state what the time is, you need to state where. To my way of thinking, "locally" doesn't cut it either. Simply saying "locally" leaves open the question of whether you mean local to the server or local to the client. How many web sites have you seen they proudly say something like "and the current time is ...."? Oh really? And how do they know? Maybe it should say "and the current time at your computer's location is ...." or maybe.....
Your astute mind has already wondered about daylight savings time considerations, hasn't it? To answer your unspoken question: operating systems adjust for daylight savings times, if applicable, before reporting the time offset. This means you don't have to worry about it. You'll only get bad information if the local computer is not correctly set up, but there's nothing you can do about that.
So, to use those methods:
In the following example we create a new date object which will hold our date and time information. We then use the getTimezoneOffset method to display the offset from GMT, and the toLocaleString and toGMTString methods to format and display the date and time local to the client machine and GMT, respectively.
ourDate = new Date();
document.write("The time and date at your computer's location is: "
document.write("The time zone offset between local time and GMT is "
+ " minutes.<br/>");
document.write("The time and date (GMT) is: "
The output of this script is the following:
In the next part of this series we'll take a closer look at the Date() object.