Setting timezone in Python

后端 未结 5 1795
我在风中等你
我在风中等你 2020-11-27 13:47

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\')         


        
5条回答
  •  抹茶落季
    2020-11-27 14:08

    For windows you can use:

    Running Windows command prompt commands in python.

    import os
    os.system('tzutil /s "Central Standard Time"')
    

    In windows command prompt try:

    This gives current timezone:

    tzutil /g

    This gives a list of timezones:

    tzutil /l

    This will set the timezone:

    tzutil /s "Central America Standard Time"

    For further reference: http://woshub.com/how-to-set-timezone-from-command-prompt-in-windows/

提交回复
热议问题