time « Format « Python Data Type Q&A

Home
Python Data Type Q&A
1.array
2.date
3.dictionary
4.Format
5.integer
6.List
7.numpy
8.regex
9.string
10.tuple
Python Data Type Q&A » Format » time 

1. Python: user friendly time format    stackoverflow.com

Python: I need to show file modification times in "1 day ago", "two hours ago", format. Is there something ready to do that? It should be in english

2. Python date formatting without space?    stackoverflow.com

How to display the following without any space also could we substitute a separator instead of space?

> log_time=datetime.datetime.now()
> print log_time
2009-12-16 16:10:03.558991

3. Converting a string to a formatted date-time string using Python    stackoverflow.com

I'm trying to convert a string "20091229050936" into "05:09 29 December 2009 (UTC)"

>>>import time
>>>s = time.strptime("20091229050936", "%Y%m%d%H%M%S")
>>>print s.strftime('%H:%M %d %B %Y (UTC)')
gives AttributeError: 'time.struct_time' object has no attribute 'strftime' Clearly, I've made a ...

4. Converting date/time in YYYYMMDD/HHMMSS format to Python datetime    stackoverflow.com

I have a date in YYYYMMDD format and a time in HHMMSS format as strings in the 4th and 5th elements in a list. I.E.:

data[4] = '20100304'
data[5] = '082835'
I am ...

5. Python: date, time formatting    stackoverflow.com

I need to generate a local timestamp in a form of YYYYMMDDHHmmSSOHH'mm'. That OHH'mm' is one of +, -, Z and then there are hourhs and minutes followed by '. Please, how ...

6. Convert seconds to end to date format    stackoverflow.com

SOAP client return seconds to end event. How can I get from this seconds date in format "yyy-mm-dd hh:ii:ss"

7. Get "2:35pm" instead of "02:35PM" from Python date/time?    stackoverflow.com

I'm still a bit slow with Python, so I haven't got this figured out beyond what's obviously in the docs, etc. I've worked with Django a bit, where they've added some ...

8. Pass parameter one time, but use more times    stackoverflow.com

I'm trying to do this:

commands = { 'py': 'python %s', 'md': 'markdown "%s" > "%s.html"; gnome-open "%s.html"', } commands['md'] % 'file.md'
But like you see, the commmands['md'] ...

9. how do I get a string format of the current date time, in python?    stackoverflow.com

A string is returned

 July 5, 2010

10. How to change time formats in python?    stackoverflow.com

How do i get the following list

 [datetime.date(2011, 4, 1), datetime.date(2011, 4, 8), datetime.date(2011, 4, 16), datetime.date(2011, 5, 21)]
as
['2011-04','2011-05']
It not only convert to string but remove ...

11. How to get formatted date time in python    stackoverflow.com

I want my Linux Filename like this

May-01-0340AM-2011.tar
How can i get the date variable formatted like above in Python IN bash i write
date1=$(date +"%b-%d-%I%M%p-%G")

12. Converting string representation of time to date time in app engine    stackoverflow.com

In standard python, I can convert a string representation of time into datetime doing this:

date_string = u'Tue, 13 Sep 2011 02:38:59 GMT';
date_object = datetime.strptime(date_string, '%a, %d %b %Y %H:%M:%S %Z');
This works ...

13. Python date/time conversion between text files    stackoverflow.com

I have a hydrologic model text file output (export.txt) that looks like: Units CFS
Type INST-VAL
1 01 Jan 1997, 02:00 1933.0
2 01 Jan 1997, 04:00 1918.0
3 01 Jan ...

14. Plotting with date/time in axis or converting format?    python-forum.org

I couldn't easily find a nice way to do it. You have the month/day/year/etc, you can do it yourself. In fact, you could go so far as to convert that to an epoch value, but if you're working from a limited dataset you could choose what to do. You have the data, and it's relatively straightforward how to get it to ...

15. date time formatting    python-forum.org

Hi All , I need to write a function which return first two values from a List . e.g --------------------------------------------------------------------- Input = (d1,d2) #d1 and d2 are date formats , e.g d1 =datetime.now()= 2010, 12, 21, 15, 36, 12, 589675 L = (d1-d2) output = first two values of the list L . ------------------------------------------------------------------------- if difference is 1 yr 4 month ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.