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 7727695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:31:25+00:00 2026-06-01T05:31:25+00:00

My code: import datetime as dt import scikits.timeseries as ts ts_start_datetime= ts.Date(freq=’T’,year=2011,month=1,day=1,hour= 0,minute=0) ts_end_datetime

  • 0

My code:

import datetime as dt
import scikits.timeseries as ts

ts_start_datetime= ts.Date(freq='T',year=2011,month=1,day=1,hour= 0,minute=0)
ts_end_datetime = ts.Date(freq='T',year=2011,month=12,day=31,hour=23,minute=45)

start_val = ts_start_datetime.value
#   21564001
end_val = ts_end_datetime.value
#   22089586

How do I convert start_val and end_val to datetime objects?

  • 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-06-01T05:31:27+00:00Added an answer on June 1, 2026 at 5:31 am

    Use datetime.fromtimestamp(), since your values appear to be minutes rather than seconds, first multiply them by 60:

    start_dt = dt.datetime.fromtimestamp(start_val * 60)
    end_dt = dt.datetime.fromtimestamp(end_val * 60)
    

    If you want a UTC time instead of a local time, use datetime.utcfromtimestamp():

    >>> dt.datetime.utcfromtimestamp(21564001 * 60)
    datetime.datetime(2011, 1, 1, 0, 1)
    >>> dt.datetime.utcfromtimestamp(22089586 * 60)
    datetime.datetime(2011, 12, 31, 23, 46)
    

    I’m not exactly sure why each of these are one minute after what you started with, you can always subtract 60 before the call or subtract dt.timedelta(minutes=1) from the end result.

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

Sidebar

Related Questions

MyCalendar.py Code: from django import template imort calendar import datetime date = datetime.date.today() week
import datetime, json x = {'alpha': {datetime.date.today(): 'abcde'}} print json.dumps(x) The above code fails
This is my code: import datetime today = datetime.date.today() print(today) This prints: 2008-11-22 which
I have this code : >>> import datetime >>> l = '2011-12-02' >>> t
This code: import datetime d_tomorrow = datetime.date.today() + datetime.timedelta(days=1) class Model(models.Model): ... timeout =
Code: class JobsManager(models.Manager): def get_active_by_category(self, cat, limit): import datetime from django.db.models import Q return
Specifically I have code that simplifies to this: from datetime import datetime date_string =
I have the following python code: from django.db import models from datetime import datetime
here is the code: import cgi import datetime import wsgiref.handlers from google.appengine.ext import db
Running the following code: import os import datetime import ftplib currdate = datetime.datetime.now() formatdate

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.