#!/usr/bin/env python

from datetime import datetime
from subprocess import call
import os, time

positive = ['Y', 'y', 'Yes', 'YES', 'yes']
negative = ['N', 'n', 'No', 'NO', 'no']

def validate(attemptedTime):
    try:
        datetime.strptime(attemptedTime, '%m/%d/%Y %H:%M')
        return True
    except ValueError:
        return False

def check_time():
    print "The current date and time is: " + time.strftime('%m/%d/%Y %H:%M')
    is_correct = raw_input("Is this correct? (Y/N)")
    if is_correct in negative:
        while True:
            print "Enter the current date in time in the 24 hour-format: MM/DD/YYYY HH:MM"
            attempted_date = raw_input("")
            if validate(attempted_date):
                break
        new_date = datetime.strptime(attempted_date, '%m/%d/%Y %H:%M')
        command = "date \"%s\"" % new_date.strftime('%m%d%H%M%y')
        os.system(command)

if __name__ == '__main__':
    check_time()
