If you are familiar with Python, then you know that it allows you to access systems and process protocols. This seems like difficult at first but it is easy if you know the correct terms and how to apply them right. So for this tutorial I will be teaching you how to display the current time and date only using Python.
So first off open up your Python GUI, or if your a beginner, download Version 2.7.2 of Python here and open the GUI.
Now we want to be able to open up a URL's Library so we can access its data. So were going type import urlllib2. This tells the computer that we are importing a url's library.
*Press Enter to move to a new line.*
Now we need to tell the computer what URL to access, so we are going to type in for line in urllib2.urlopen. This tells the computer to open a url. Now we need to type in the url that we need to access. Type in parentheses and apostrophes the URL we are using which is http://tycho.usno.navy.mil/cgi-bin/timer.pl.
Now we want to tell the computer which timezone we are in so it can output the right time. I, myself, am on the East Coast so I will tell the computer to select eastern time. Now we are going to enter if 'EST' in line or 'EDT' in line:, and I entered in EST and EDT because those are the Eastern Timezone abbreviations.
Finally we need the computer to output the data that we told it to find, so in simple words we need the computer to print out the information. So we are going to type in print line.
After pressing enter, hit enter again to get your result, which should look like something below.
Now the computer has outputted that it's July 24th and it's 7:48pm.
Congrats! You've just learned how to display the time and date using only the Python Language.