Anjar Syaefa

Jumat, 03 April 2015

Time

from time import strftime
from datetime import datetime



class raspberryDateTime:

    def get_date(self):
        date = datetime.now().strftime('%b %d %y')
        # In date string we store the date in format Month-Day-Year
        return date
   
    def get_time(self):
        time = datetime.now().strftime('%H:%M:%S')
        # In time string we store the time in format Hours:Minutes:Seconds
        return time

def main():
    dateTime = raspberryDateTime()
    print 'Your Raspberrt Pi date is: ', dateTime.get_date()
    print 'Time: ', dateTime.get_time()

if __name__ == '__main__':
    main()

Tidak ada komentar:

Posting Komentar