Saturday 16 July 2016

Need Change GMT with Function Python


https://dedyyuristiawan.blogspot.co.id


Hello world. Today i am gonna show you, how to change time with function. Last post i just share how to show datetime field without wrong show, i just share without create function python. So today i gonna show you change Datetime field with function, sometimes after try any failed solution, we don't have choice to get great solution, we must create function to get great solution.

So for this post i gonna show you function python to change datetime with plus or minus requirement. This is my function python. 

def _add_hour(self, vdate):
    a_time = datetime.strptime(vdate, "%Y-%m-%d %H:%M:%S")
    a_time += timedelta(hours=7)
    b_time = a_time.strftime("%d/%m/%Y %H:%M:%S")
    
    return b_time

In this function i just change time with +7 hour, and after that i change format date like human know, not computer know. Lol.

For my last word, the conclusion is at least we must know how to get the purpose, whatever we chose another way, cause someday we certainly use it.
Share:
Lokasi: Semarang, Semarang City, Central Java, Indonesia

1 comment:

  1. Great article! Thanks for sharing this informative article. Looking for the best Software Development Company in Australia? Reach IDYA Technology.

    ReplyDelete


<br>


Advice for contacting me at dedyy54@gmail.com