You can convert Australian Central Time (ACT) to GMT using the datetime
and timezone
modules in Python. Here's an example code snippet to demonstrate the conversion:
main.py414 chars15 lines
In this example, we first create a datetime
object with the ACT timezone using the pytz.timezone()
function. Then, we convert this to the GMT timezone using the astimezone()
function and another pytz.timezone()
call. Finally, we print the results using the strftime()
method to format the output.
Note that you'll need to have the pytz
module installed in your environment to run this code. If you're using Python 3.9+, you can use the built-in zoneinfo
module instead of pytz
.
gistlibby LogSnag