Games & Quizzes
Don't forget to Sign In to save your points
PERFECT HITS | +NaN | |
HITS | +NaN | |
LONGEST STREAK | +NaN | |
TOTAL | + |
hi there serdar yagulp here for infoworld in this episode of smart go we're going to take a closer
look at the way go handles date and time values by way of the time module the time module and go
gives us access to objects and methods that let us get the current time create time and date values
from scratch and perform formatting on existing time values it also gives us tools for working
with time zones easily one of the least favorite aspects of dealing with date and time values if
you're a programmer but the time module helps handle those things in a straightforward way
let's start with a simple example getting the current time and printing it to the console here
first we import the time module and then we use the time.now method to get the current time and
date from the system and store it in the variable t now if we print this to the console like this
we're going to get a very complex and detailed output this includes the date the time the time
zone and some additional information about the current processes monotonic clock that's something
that's used to measure elapsed time between events inside a process instead of the absolute time of
the system at large that's something worth going into detail about in its own video though so for
now we'll leave it alone now if we just want to print a few details about the current date
and time instead of the whole thing we could use the format method of the time object to do this
with format we pass along a special formatting code which looks a little bit like a date and time
but is actually a way to indicate how to format specific components of the date and time
for instance in in the format string we have this code 2006 that's actually an indication we want
to insert a four digit year so when we run this code we will see only a few parts of the date and
time the ones that we most need now let's say i want to create a time and date value from scratch
/ˈspeSHəl/
better, greater, or otherwise different from what is usual. thing.
material thing. Some things you can see or touch, but is not alive. express disagreement.
/ˈaspekt/
part or feature. Elements, features, or qualities of something. form aspect with.
Not being simple; having many parts or aspects. group of buildings or facilities. cause to form complex.
/ˈsamp(ə)liNG/
taking of sample or samples. To try (e.g. food), to see if you like it.
/rəˈlēs/
Act of freeing someone from a duty or burden. To allow to leave a jail, cage, etc.; let out.
/ˈabsəˌlo͞ot/
Complete; total; pure; not limited in any way. value or principle.
/kəmˈpōnənt/
part or element of larger whole. Parts that some things are made up of.