Is it possible with Python to set the timezone just like this in PHP:
date_default_timezone_set("Europe/London");
$Year = date('y');
$Month = date('m');
$Day = date('d');
$Hour = date('H');
$Minute = date('i');
I can't really install any other modules etc as I'm using shared web hosting.
Any ideas?
To get the specific values you've listed:
See here for a complete list of directives. Keep in mind that the strftime() function will always return a string, not an integer or other type.
It's not an answer, but...
To get
datetime
components individually, better use datetime.timetuple:It's now easy to get the parts:
For windows you can use:
Running Windows command prompt commands in python.
In windows command prompt try:
This gives current timezone:
This gives a list of timezones:
This will set the timezone:
For further reference: http://woshub.com/how-to-set-timezone-from-command-prompt-in-windows/