當前位置: 首頁>>代碼示例>>Python>>正文


Python time.ctime方法代碼示例

本文整理匯總了Python中datetime.time.ctime方法的典型用法代碼示例。如果您正苦於以下問題:Python time.ctime方法的具體用法?Python time.ctime怎麽用?Python time.ctime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在datetime.time的用法示例。


在下文中一共展示了time.ctime方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_ctime

# 需要導入模塊: from datetime import time [as 別名]
# 或者: from datetime.time import ctime [as 別名]
def test_ctime(self):
        t = self.theclass(2002, 3, 2)
        self.assertEqual(t.ctime(), "Sat Mar  2 00:00:00 2002") 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:5,代碼來源:test_datetime.py

示例2: test_more_ctime

# 需要導入模塊: from datetime import time [as 別名]
# 或者: from datetime.time import ctime [as 別名]
def test_more_ctime(self):
        # Test fields that TestDate doesn't touch.
        import time

        t = self.theclass(2002, 3, 2, 18, 3, 5, 123)
        self.assertEqual(t.ctime(), "Sat Mar  2 18:03:05 2002")
        # Oops!  The next line fails on Win2K under MSVC 6, so it's commented
        # out.  The difference is that t.ctime() produces " 2" for the day,
        # but platform ctime() produces "02" for the day.  According to
        # C99, t.ctime() is correct here.
        # self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple())))

        # So test a case where that difference doesn't matter.
        t = self.theclass(2002, 3, 22, 18, 3, 5, 123)
        self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple()))) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:17,代碼來源:test_datetime.py

示例3: ctime

# 需要導入模塊: from datetime import time [as 別名]
# 或者: from datetime.time import ctime [as 別名]
def ctime():
        """Return a string representing the date.

        For example date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple()))
        on platforms where the native C ctime() function
        (which time.ctime() invokes, but which date.ctime() does not invoke)
        conforms to the C standard.
        """ 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:11,代碼來源:idatetime.py

示例4: ctime

# 需要導入模塊: from datetime import time [as 別名]
# 或者: from datetime.time import ctime [as 別名]
def ctime():
        """Return a string representing the date.

        For example date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
        d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple()))
        on platforms where the native C ctime() function
        (which `time.ctime` invokes, but which date.ctime() does not invoke)
        conforms to the C standard.
        """ 
開發者ID:wistbean,項目名稱:learn_python3_spider,代碼行數:11,代碼來源:idatetime.py


注:本文中的datetime.time.ctime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。