Differences between revisions 1 and 8 (spanning 7 versions)
Revision 1 as of 2018-10-11 15:10:19
Size: 2468
Comment:
Revision 8 as of 2019-10-09 15:00:32
Size: 2537
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
[ <<Action(edit)>> ]
Line 14: Line 14:
{{{#!highlight python {{{#!highlight python numbers=off
Line 23: Line 23:
    * now() クラスメソッド → 今の日付・時刻を表すtps://docs.python.jp/3/library/datetime.html#datetime-objects|datetimeオブジェクト]]を返す     * now() クラスメソッド → 今の日付・時刻を表す[[https://docs.python.jp/3/library/datetime.html#datetime-objects|datetimeオブジェクト]]を返す
Line 25: Line 25:
{{{#!highlight python {{{#!highlight python numbers=off
Line 38: Line 38:
{{{#!highlight python {{{#!highlight python numbers=off
Line 56: Line 56:
{{{#!highlight python {{{#!highlight python numbers=off

[ edit ]

import datetime

def today():
    return( datetime.date.today() )

import datetime

def now():
    return( datetime.datetime.now() )

import datetime

def today_str():
    date_of_today = today()
    return( str( date_of_today.year  ) + "" + 
            str( date_of_today.month ) + "" +
            str( date_of_today.day   ) + "" )

import datetime

def now_str():
    current_time = now()
    return( str( current_time.hour   ) + "" + 
            str( current_time.minute ) + "" + 
            str( current_time.second ) + "" + 
            str( current_time.microsecond ) + "μ秒" )

SoftEng: Python/Prog/Example/02/Ex_005a/Digest (last edited 2019-10-09 15:00:32 by TadashiIijima)