Source From Here
Question
I'm utilizing the datetime module to produce the current date. Is any way to setup the different timezone in this module?
How-To
Your date is a "naive" datetime, it doesn't have a timezone (tz=None). Then you have to localize this datetime by setting a timezone. Use pytz module to do that.
From the Linux, you can check your default timezone by (Take CentOS7 for example):
Question
I'm utilizing the datetime module to produce the current date. Is any way to setup the different timezone in this module?
How-To
Your date is a "naive" datetime, it doesn't have a timezone (tz=None). Then you have to localize this datetime by setting a timezone. Use pytz module to do that.
From the Linux, you can check your default timezone by (Take CentOS7 for example):
沒有留言:
張貼留言