Any tips? How can we use&show local times and letters in C9

python

#1

Any tips? for python: I want to use and have results in local time and the letters.
Cloud9 is bit limited service to use other languages/command (example: Japan…),
-If there are some tips, it will be so comfortably useful.
-the code for a local language doesn’t work…

I input the following..only UTC time is showed up..

import datetime
-------------obmit--------

today’s date

-------------obmit----
print todaydetail.hour
print todaydetail.minute

Thanks,
Mahalo-


#2

The default timezone in all workspaces is UTC. if you’re using python, the built in datetime lib is rather annoying for timezones.

try using pytz: http://pytz.sourceforge.net/

e.g.:

from datetime import datetime
from pytz import timezone

japan = timezone('Japan')

utc_time = datetime.now()
japan_time = japan(utc_time)

That will return japan_time as a datetime object with the correct timezones set. Doing this with the datetime library directly is easily 3-4x more code.


#3

Thanks with that ref link〜

I tried Japan time zone with the reference codes.

I tried in some ways, but it didn’t work japan = timezone(‘Japan’) japan_time=today.
todaydetail.

The following error showed up…


#4

I tried in some ways, but the following error shows up…

from pytz import timezone
importError: No module named pytz