Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6908855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:36:55+00:00 2026-05-27T08:36:55+00:00

Totally new to python, I’m actually working on an ex-colleague’s script. in looking at

  • 0

Totally new to python, I’m actually working on an ex-colleague’s script. in looking at it it seems fairly straight-forward. Here’s the situation:

The script looks at current localtime (UTC) and renders a time-based table that scrolls/changes throughout the day as the hours pass so there’s always a rolling 8 hour table.

The problem is that now we’d like to deploy a copy of this tool (on the same server) in CST (‘America/Chicago’) (meaning I need to change the UTC time to CST) so I’m just trying to find a way to modify what he has to make the ‘current_time’ variable == GMT -6.

He used strftime() to get the first hour:

current_time = int(strftime("%H"))
if current_time <19:
temp_page.write(...)
elif current_time == 19:
temp_page.write(...)

etc.

So – from my php knowledge, I’d love to be able to do something like:

current_time = int(strftime("%H"), (localtime() -6 hours))

(yes, I realize that’s not real php code, but hopefully you get my meaning ;-))

In my research, I’ve come across pytz, but this is not installed on the webserver, though I can probably get it if that’s the best/easiest way too implement it.

Any help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:36:56+00:00Added an answer on May 27, 2026 at 8:36 am

    You could probably use the datetime module (it’s part of the standard library, so it’s installed if a standard python is on the system).

    In particular, datetime objects can have an optional tzinfo attribute, used during timezone conversions. Here‘s a blog post that explains step-by-step how to use those.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am totally new to math/numerical analysis programming and I was looking all over
I'm totally new to GreaseMonkey, but I'm trying to make a little script. //
I´m totally new to Powershell and wanted to write a script that deletes all
I just started to learn python, and i'm totally new and n00b. Normally i
I know PHP a little. But Python is totally new for me. I only
Good day, I am totally new to Python and I am trying to do
im totally new to rails. here my question: i made an app with articles
I'm totally new to Python (as of half an hour ago) and trying to
i have a question because i am fairly new to python, socket programming and
Totally new to Spring & Java development but working on a project for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.