WebFaction
Community site: login faq

I have few python scripts which have been written to run specifically in IST (Indian Standard Time, GMT +5:30). I want to automate them using cron at my server side. Can somebody let me know the way to set TZ to IST so that whenever the python scripts find below code they should return values based on IST ?

now = datetime.datetime.now().time()
or
datetime.datetime.today()

asked 24 Sep '13, 08:31

nehemiah
325
accept rate: 0%


You can use this command in shell to change timezone,

export TZ=IST

You can create a shell script with hashbang on line 1, export TZ on line 2 and your script on line 3 for cron jobs.

permanent link

answered 24 Sep '13, 17:16

johns
5.4k312
accept rate: 23%

edited 24 Sep '13, 17:17

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×8
×1

question asked: 24 Sep '13, 08:31

question was seen: 6,114 times

last updated: 24 Sep '13, 17:17

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM