time မော်ဂျူး၏ ctime method
time မော်ဂျူး၏ ctime method သည်
စက္ကန့်များကို ရက်စွဲနှင့် အချိန်ပါသည့် string အဖြစ်
ပြောင်းလဲပေးသည်။ method ၏ မဖြစ်မနေထည့်ရန် မလိုအပ်သော parameter တွင်
epoch စတင်ချိန်မှ စက္ကန့်ဖြင့် အချိန်ကို ဖော်ပြသည်။
Syntax
import time
time.ctime([epoch စတင်ချိန်မှ စက္ကန့်ဖြင့် အချိန်])
ဥပမာ
စက္ကန့်များကို အချိန်နှင့် ရက်စွဲပါသည့် string အဖြစ် ပြောင်းလဲကြည့်ရအောင်:
import time
res = time.time()
res = time.ctime(res)
print(res)
run ထားသော code ၏ ရလဒ်:
Mon Jul 31 17:46:57 2023
ဤအကြောင်းကိုလည်း ကြည့်ပါ
-
strftimemethod ofdatetimemodule,
which creates a formatted string with date and time -
timemethod oftimemodule,
which returns time in seconds since the epoch -
localtimemethod oftimemodule,
which converts seconds to local time -
gmtimemethod oftimemodule,
which converts seconds to UTC format -
mktimemethod oftimemodule,
which converts a string with date and time to seconds -
sleepmethod oftimemodule,
which stops operation execution for a specified number of seconds