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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:45:30+00:00 2026-05-18T01:45:30+00:00

In this Python package there is this code: >>> dt = DateTime(‘Mar 9, 1997

  • 0

In this Python package there is this code:

>>> dt = DateTime('Mar 9, 1997 13:45:00 US/Eastern')
>>> dt.timeTime()
857933100.0

I would use this package but there is a warning: “Unless you need to communicate with Zope 2 APIs, you’re probably better off using Python’s bult-in datetime module.”

TimeProperty in GAE gives me something like this 02:37:31.797000 How do I convert it to a number as in the example so that I can add an integer to it and sort by the new value. I want to achieve some kind of weighed sort. Thanks.

EDIT

@Robert Kluin:

Thanks; this works:

>>> today = datetime.datetime.today().toordinal()
>>> today
734086
>>>

But I have a DateTime object that I am using in the query to sort; so this works:

    QUERY2 = Rep.all()
    QUERY2.filter("mAUTHOR =", user)
    QUERY2.order("-mDATE")
    RESULTS2 = QUERY2.fetch(10)

But when I try this, it does not work:

    QUERY2 = Rep.all()
    QUERY2.filter("mAUTHOR =", user)
    QUERY2.order("-(datetime.datetime.mDATE.toordinal())")
    RESULTS2 = QUERY2.fetch(10) 

I get the error:

PropertyError: Invalid property name '(datetime.datetime.mDATE.toordinal())'

This is the value of mDATE as printed by the template:

mDATE = 2010-11-10 05:38:55.340000 
  • 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-18T01:45:31+00:00Added an answer on May 18, 2026 at 1:45 am

    Check out the time module.

    import time
    value = time.time()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to replicate this in python: gvimdiff <(hg cat file.txt) file.txt (hg
I ended up writing a quick little script for this in Python, but I
This came up in Hidden features of Python , but I can't see good
This particular example relates to Django in Python, but should apply to any language
I'm developing a Python application; it has all its code in one package and
I'm trying to use a python package from IronPython. Everything works fine if I
I use python 2.4.1 on Linux, and a python package written inside the company
I am new to Python and mostly used my own code. But so now
I'm trying to write a python script that packages our software. This script needs
Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable

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.