Python time module ⌚

Поделиться
HTML-код
  • Опубликовано: 14 янв 2025

Комментарии • 66

  • @BroCodez
    @BroCodez  4 года назад +30

    # ***************************************************************************
    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)
    # ***************************************************************************

  • @farhan8834
    @farhan8834 2 года назад +9

    The generosity I feel when I copy your neat and clean code with proper comments is too amazing, GREAT QUALITY CONTENT !!❤

  • @carterjackson7460
    @carterjackson7460 4 года назад +16

    perfect timing :)

    • @oldplagu3
      @oldplagu3 2 года назад +1

      hahah good one

  • @jhassee
    @jhassee 2 года назад +9

    I paid for courses and didn't learn anything, this guy an maybe 4 others on RUclips taught me the ins and outs of python. Paying is not always the answer as I've learned

    • @cr1azak
      @cr1azak Год назад +2

      Can you tell me names of the other 4 channels please.

    • @aureliano_37
      @aureliano_37 Год назад +3

      Who are the 4 others?

  • @kube4202
    @kube4202 3 года назад +7

    bro, You helped me more than my teacher did, so much love

  • @lordrobertclive-vc5ld
    @lordrobertclive-vc5ld 4 месяца назад +2

    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.

  • @amf-z7x
    @amf-z7x Год назад +1

    الشرح ممتاز =)

  • @suman_sourav
    @suman_sourav Год назад

    liked it. and subscribed

  • @ummanmemmedov
    @ummanmemmedov Год назад

    Excellent!

  • @WhishoMH
    @WhishoMH Год назад +2

    this was actually uselfull, thanks for the eforts! you solved the complete misundertanding I had with that python documentation really. < 3

  • @lukascampidell9376
    @lukascampidell9376 11 месяцев назад +1

    I don't use the time module that often, so this was very helpful!

  • @varunahlawat9013
    @varunahlawat9013 Год назад

    simply neat

  • @SouravDash-di3vj
    @SouravDash-di3vj 6 месяцев назад

    that's really help me bro to understand the basic things of time module keep going on like this

  • @kindasus-pn2lr
    @kindasus-pn2lr 5 месяцев назад

    🔥

  • @kellarin
    @kellarin 2 года назад +2

    Why are our epoch times identical! I'm not even kidding. That's kind of spooky.

  • @calsbergus
    @calsbergus 2 года назад

    Very good tutorial!

  • @hanliaharmony
    @hanliaharmony 8 месяцев назад

    thanks for help

  • @lw9954
    @lw9954 2 года назад +2

    TY BRO

  • @cristiucvladimir7909
    @cristiucvladimir7909 8 месяцев назад +1

    Thanks bro!

  • @ilordepic
    @ilordepic 2 года назад

    another comment for the algorithm bro thanks a lot

  • @rubenc4696
    @rubenc4696 8 месяцев назад

    Thanks

  • @saikokun541
    @saikokun541 2 года назад

    Awesome

  • @beingzero7541
    @beingzero7541 2 года назад

    Wow!

  • @onurdogan2390
    @onurdogan2390 3 года назад

    yo amazing

  • @HussainAli-sb1dv
    @HussainAli-sb1dv Год назад

    love u

  • @mohmedmohmed7399
    @mohmedmohmed7399 Год назад

  • @7even255
    @7even255 2 года назад

    I love how your example for the tuple is 4/20 at 4:20am

  • @piotrkopcewicz5227
    @piotrkopcewicz5227 2 года назад

    god is time thx as always !!!!

  • @mendozosa
    @mendozosa 2 года назад +1

    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

    • @mo-ab7315
      @mo-ab7315 Год назад

      hows the programming life ?

    • @shasvat0
      @shasvat0 Год назад

      @@mo-ab7315 you tell me

  • @EissaAlahdul
    @EissaAlahdul 2 года назад

    شكرا

  • @ruhaprpl
    @ruhaprpl 2 года назад

    Bro

  • @Amir_Plays_non_stop
    @Amir_Plays_non_stop 3 года назад

    Nice

  • @bekturasanbekov1979
    @bekturasanbekov1979 Год назад

    thx 4 vid bro !

  • @chrisdavies6221
    @chrisdavies6221 2 года назад +1

    Hey Bro, loving the tutorials.
    Can I ask what would be a use for referencing the epoch time?

  • @gingercholo
    @gingercholo 3 года назад

    Yo bro this was great

  • @SuperStarEevee
    @SuperStarEevee 2 года назад

    Thank you!

  • @LimeSpeedCrystal
    @LimeSpeedCrystal 2 года назад

    My chat with a bot now can tell the time! Thank you!

  • @gustavoaponte1814
    @gustavoaponte1814 Год назад

    meow~! ^o^

  • @Adamelamine
    @Adamelamine 2 года назад

    Drop a comment down below

  • @uuhju7004
    @uuhju7004 3 года назад

    ty

  • @hameeeed5992
    @hameeeed5992 Год назад

    :)

  • @nukhbaiqbal7798
    @nukhbaiqbal7798 4 года назад +1

    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.

  • @shaktibal5121
    @shaktibal5121 2 года назад

    So much better than reading - thanks

  • @wmstram1
    @wmstram1 Год назад

    Watched it. Think Python could have made this a lot more elegant.

  • @TigerBros
    @TigerBros Год назад

    How can I fix the perf_counter it's giving high values that isn't true

  • @murilosilvestre7736
    @murilosilvestre7736 3 года назад +1

    our epoch time are only 5 hours away from each other :D

  • @provokator-provocateur7603
    @provokator-provocateur7603 3 года назад +3

    mktime() ? mortal kombat time? Well that's my favorite time.

  • @shasvat0
    @shasvat0 Год назад

    at 4:00

  • @joyedet1363
    @joyedet1363 2 года назад +1

    Mine rad Thu Jan 01:00:00 1970
    How about yours?🔥🤩

  • @kyu2813
    @kyu2813 Год назад

    Is that how you pronounce epoch?? Lol I've been pronouncing it as ee-pock my whole life

  • @jhassee
    @jhassee 2 года назад

    so it is not apparent that bro smokes the devils lettuce hahahaha

  • @aureliano_37
    @aureliano_37 Год назад

    Where's the code?

  • @francisfigueroaiii5383
    @francisfigueroaiii5383 Год назад

    g

  • @Akxperto7
    @Akxperto7 Год назад

    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

  • @jamshidkushbaev2873
    @jamshidkushbaev2873 Год назад

    bro, You helped me more than my teacher did, so much love

  • @PlusUltraNerdO-O
    @PlusUltraNerdO-O 4 месяца назад

    Thanks

  • @snowhe7208
    @snowhe7208 2 года назад

    Nice

  • @iliyasalimipor7565
    @iliyasalimipor7565 Месяц назад

    Nice