opkg update
opkg install python-openssl #adds ssl support to python
opkg install distribute #it contains the easy_install command line tool (this can take some time)
easy_install pip #installs pip  (this can take some time)
pip install pytz
nano getdatetime.py
#!/usr/bin/python
import datetime
import pytz
def getdatetime_with_timezone():
        fmt = '%Y-%m-%d %H:%M:%S %Z'
        d = datetime.datetime.now(pytz.timezone("America/New_York"))
        d_string = d.strftime(fmt)
        return d_string
print getdatetime_with_timezone()
chmod 755 getdatetime.py
./getdatetime.py
2024-09-30 15:30:58 EDT

Comments powered by CComment