I had asked same question before but it was marked as duplicate. Opening a new question because only part of my question was answered.
The code in above link shows the time after adding 9 hours to current time. But I actually need to alter the system time in linux and solaris hosts.
Below is the code I used from above link, but I need to modify system time.
#!/usr/bin/python
from datetime import datetime, timedelta
nine_hours_from_now = datetime.now() + timedelta(hours=9)
print str(datetime.now())
print str(format(nine_hours_from_now, '%H:%M:%S'))
After obtaining the value nine_hours_from_now
it needs to be set as system time.