Skip to content

Commit 6e2d1e7

Browse files
authored
Apply suggestion from @avdhoottt
1 parent 97ff09e commit 6e2d1e7

File tree

1 file changed

+2
-1
lines changed
  • content/python/concepts/time-module/terms/gmtime

1 file changed

+2
-1
lines changed

content/python/concepts/time-module/terms/gmtime/gmtime.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ In this example, the current UTC time is retrieved using `gmtime()`, and then a
3535

3636
```py
3737
import time
38+
import calendar
3839

3940
# Get the current time in UTC
4041
current_time = time.gmtime()
4142
print("Current UTC time:", current_time)
4243

4344
# Convert a specific time (e.g., 1st January 2020) to UTC
44-
specific_time = time.mktime((2020, 1, 1, 0, 0, 0, 0, 0, 0))
45+
specific_time = calendar.timegm((2020, 1, 1, 0, 0, 0, 0, 0, 0))
4546
utc_time = time.gmtime(specific_time)
4647
print("Specific UTC time:", utc_time)
4748
```

0 commit comments

Comments
 (0)