# *************************************************************************** import time # *************************************************************************** print(time.ctime(0)) # convert a time expressed in seconds since epoch to a readable string # epoch = when your computer thinks time began (reference point) print(time.time()) # return current seconds since epoch print(time.ctime(time.time())) # will get current time # *************************************************************************** # time.strftime(format, time_object) = formats a time_object to a string # time_object = time.localtime() # local time # time_object = time.gmtime() # UTC time # local_time = time.strftime("%B %d %Y %H:%M:%S", time_object) # print(local_time) # *************************************************************************** # time.strptime(time_string, format) = parses a string representing time/date and returns a struct_time object # time_string = "20 April, 2020" # time_object = time.strptime(time_string,"%d %B, %Y") # print(time_object) # *************************************************************************** # time.asctime(time_tuple) = accepts a time_object or a tuple up to 9 elements and returns a string # (year, month, day, hours, minutes, secs, day of the week, day of the year, dst) # time_tuple = (2020, 4, 20, 4, 20, 0, 0, 0, 0) # time_string = time.asctime(time_tuple) # print(time_string) # *************************************************************************** # time.asctime(time_tuple) = accepts a time_object or a tuple up to 9 elements and return seconds since epoch # (year, month, day, hours, minutes, secs, day of the week, day of the year, dst) # time_tuple = (2020, 4, 20, 4, 20, 0, 0, 0, 0) # time_string = time.mktime(time_tuple) # print(time_string) # ***************************************************************************
I paid for courses and didn't learn anything, this guy an maybe 4 others on TH-cam taught me the ins and outs of python. Paying is not always the answer as I've learned
time() Returns the current time in seconds since the Epoch. sleep(seconds) Pauses execution for the given number of seconds. ctime([seconds]) Converts seconds since the Epoch to a string representing local time. strftime(format) Converts struct_time to a string according to the given format. localtime([secs]) Converts seconds to struct_time in local time. gmtime([secs]) Converts seconds to struct_time in UTC. mktime(t) Converts struct_time to seconds since the Epoch. perf_counter() High-resolution performance counter for measuring elapsed time. monotonic() Monotonic clock for time measurement. time_ns() Current time in nanoseconds since the Epoch.
This tutorial has been the only one that help me with the time module cause the other codes didn't run at all, just gave me traceback errors, I'm trying to figure out the time and dates syntax
Hey, Is there some way to ask user to enter a line but within a time limit in python I mean for example there is only 10s to write a line by user and if he didn't write within 10s the program says TIME IS OVER.
currently daylight savings time is on and when i pass time.gmtime(), it shows tm_isdst=0. it shows the time accurate to minute but just an hour offto make up for the daylight savings time
# ***************************************************************************
import time
# ***************************************************************************
print(time.ctime(0)) # convert a time expressed in seconds since epoch to a readable string
# epoch = when your computer thinks time began (reference point)
print(time.time()) # return current seconds since epoch
print(time.ctime(time.time())) # will get current time
# ***************************************************************************
# time.strftime(format, time_object) = formats a time_object to a string
# time_object = time.localtime() # local time
# time_object = time.gmtime() # UTC time
# local_time = time.strftime("%B %d %Y %H:%M:%S", time_object)
# print(local_time)
# ***************************************************************************
# time.strptime(time_string, format) = parses a string representing time/date and returns a struct_time object
# time_string = "20 April, 2020"
# time_object = time.strptime(time_string,"%d %B, %Y")
# print(time_object)
# ***************************************************************************
# time.asctime(time_tuple) = accepts a time_object or a tuple up to 9 elements and returns a string
# (year, month, day, hours, minutes, secs, day of the week, day of the year, dst)
# time_tuple = (2020, 4, 20, 4, 20, 0, 0, 0, 0)
# time_string = time.asctime(time_tuple)
# print(time_string)
# ***************************************************************************
# time.asctime(time_tuple) = accepts a time_object or a tuple up to 9 elements and return seconds since epoch
# (year, month, day, hours, minutes, secs, day of the week, day of the year, dst)
# time_tuple = (2020, 4, 20, 4, 20, 0, 0, 0, 0)
# time_string = time.mktime(time_tuple)
# print(time_string)
# ***************************************************************************
The generosity I feel when I copy your neat and clean code with proper comments is too amazing, GREAT QUALITY CONTENT !!❤
I paid for courses and didn't learn anything, this guy an maybe 4 others on TH-cam taught me the ins and outs of python. Paying is not always the answer as I've learned
Can you tell me names of the other 4 channels please.
Who are the 4 others?
perfect timing :)
hahah good one
bro, You helped me more than my teacher did, so much love
I don't use the time module that often, so this was very helpful!
الشرح ممتاز =)
this was actually uselfull, thanks for the eforts! you solved the complete misundertanding I had with that python documentation really. < 3
that's really help me bro to understand the basic things of time module keep going on like this
time() Returns the current time in seconds since the Epoch.
sleep(seconds) Pauses execution for the given number of seconds.
ctime([seconds]) Converts seconds since the Epoch to a string representing local time.
strftime(format) Converts struct_time to a string according to the given format.
localtime([secs]) Converts seconds to struct_time in local time.
gmtime([secs]) Converts seconds to struct_time in UTC.
mktime(t) Converts struct_time to seconds since the Epoch.
perf_counter() High-resolution performance counter for measuring elapsed time.
monotonic() Monotonic clock for time measurement.
time_ns() Current time in nanoseconds since the Epoch.
liked it. and subscribed
Why are our epoch times identical! I'm not even kidding. That's kind of spooky.
Excellent!
TY BRO
🔥
Very good tutorial!
another comment for the algorithm bro thanks a lot
simply neat
Thanks bro!
I love how your example for the tuple is 4/20 at 4:20am
❤
thanks for help
thx 4 vid bro !
god is time thx as always !!!!
This tutorial has been the only one that help me with the time module cause the other codes didn't run at all, just gave me traceback errors, I'm trying to figure out the time and dates syntax
hows the programming life ?
@@mo-ab7315 you tell me
Thanks
Yo bro this was great
Awesome
love u
Wow!
yo amazing
Nice
Bro
So much better than reading - thanks
شكرا
My chat with a bot now can tell the time! Thank you!
Thank you!
meow~! ^o^
Watched it. Think Python could have made this a lot more elegant.
Hey Bro, loving the tutorials.
Can I ask what would be a use for referencing the epoch time?
Drop a comment down below
Hey, Is there some way to ask user to enter a line but within a time limit in python I mean for example there is only 10s to write a line by user and if he didn't write within 10s the program says TIME IS OVER.
at 4:00
How can I fix the perf_counter it's giving high values that isn't true
ty
Mine rad Thu Jan 01:00:00 1970
How about yours?🔥🤩
our epoch time are only 5 hours away from each other :D
mktime() ? mortal kombat time? Well that's my favorite time.
FATALITY
@@BroCodez mktime().finish_him() !!! 😁
:)
so it is not apparent that bro smokes the devils lettuce hahahaha
Is that how you pronounce epoch?? Lol I've been pronouncing it as ee-pock my whole life
g
Where's the code?
currently daylight savings time is on and when i pass time.gmtime(), it shows tm_isdst=0. it shows the time accurate to minute but just an hour offto make up for the daylight savings time
bro, You helped me more than my teacher did, so much love
Thanks
Nice
Nice