datetime « string « 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 » string » datetime 

1. Parsing datetime strings with microseconds    stackoverflow.com

I have a text file with a lot of datetime strings in isoformat. The strings are similar to this: '2009-02-10 16:06:52.598800' These strings were generated using str(datetime_object). The problem is that, for some ...

2. app engine: string to datetime?    stackoverflow.com

i have string

date = "11/28/2009"
hour = "23"
minutes = "59"
seconds = "00"
how can i convert to datetime object and store it in datastore?

3. convert string of millisecond into datetime in python    stackoverflow.com

I am a newbie in Python. I want to subtract interval time from my log file, but the problem is I cannot convert millisecond string of log file into datetime format. ...

4. Is this the correct way to convert a UTC datetime string into localtime?    stackoverflow.com

Is this the correct way to convert a UTC string into local time allowing for daylight savings? It looks ok to me but you never know :)

import time
UTC_STRING = "2010-03-25 02:00:00"
stamp ...

5. Converting string to datetime object in python    stackoverflow.com

Given this string: "Fri, 09 Apr 2010 14:10:50 +0000" how does one convert it to a datetime object? After doing some reading I feel like this should work, but it doesn't...

>>> from ...

6. Convert time string expressed as [m|h|d|s|w] to seconds in Python    stackoverflow.com

Is there a good method to convert a string representing time in the format of [m|h|d|s|w] (m= minutes, h=hours, d=days, s=seconds w=week) to number of seconds? I.e.

def convert_to_seconds(timeduration):
    ...

7. Lets say I have a string...how do I convert that to a datetime?    stackoverflow.com

s = "June 19, 2010"
How do I conver that to a datetime object?

8. Convert string timestamp (with timezone offset) to local time. . ? python    stackoverflow.com

I am trying to convert a string timestamp into a proper datetime object. The problem I am having is that there is a timezone offset and everything I am doing doesn't ...

9. string to datetime with fractional seconds, on Google App Engine    stackoverflow.com

I need to convert a string to a datetime object, along with the fractional seconds. I'm running into various problems. Normally, i would do:

>>> datetime.datetime.strptime(val, "%Y-%m-%dT%H:%M:%S.%f")
But errors and old docs showed me ...

10. How can I convert the time in a datetime string from 24:00 to 00:00 in Python?    stackoverflow.com

I have a lot of date strings like Mon, 16 Aug 2010 24:00:00 and some of them are in 00-23 hour format and some of them in 01-24 hour format. I ...

11. String to datetime    stackoverflow.com

I saved a datetime.datetime.now() as a string. Now I have a string value, i.e.

2010-10-08 14:26:01.220000
How can I convert this string to
Oct 8th 2010
? Thanks

12. convert string to datetime object    stackoverflow.com

I'd like to convert this string into a datetime object:

Wed Oct 20 16:35:44 +0000 2010
Is there a simple way to do this? Or do I have to write a RE ...

13. how to convert a datetime string back to datetime object?    stackoverflow.com

I am storing the datetime string in the database, now I meet a problem that when I fetch the string from database I need to convert it back to datatime object... Any ...

14. Exception while converting string to datetime in python on GAE with timezone?    stackoverflow.com

I am getting this exception

time data did not match format:  data=19:51:06 Jan 17, 2011 PST  fmt=%H:%M:%S %b %d, %Y %Z
for following code
datetime.strptime(parameters['19:51:06 Jan 17, 2011 PST'], "%H:%M:%S %b ...

15. Python - Convert UTC datetime string to local datetime    stackoverflow.com

Experienced programmer here, but I've never had to convert time to and from utc. Recently had a request to have my app be timezone aware, and I've been running myself in ...

16. python variable in the function call    stackoverflow.com

i'm trying to create a directory/folder in linux using python. I will get date time and make a folder.

In [65]: d = datetime.datetime.now()

In [66]: a = 'date :' + str(d)

In ...

17. How to convert string to datetime in python    stackoverflow.com

I have a date string in following format 2011-03-07 how to convert this to datetime in python?

18. Datetime string with timezone in Python?    stackoverflow.com

I'm working on Google app engine with Python. I have stored a datetime object in database and fetched it and applied timezone, and I saved it using template. The result is "2011-03-15 ...

19. Convert a string to datetime object in python    stackoverflow.com

I have a date string defined as followed:

datestr = '2011-05-01'
I want to convert this into a datetime object so i used the following code
dateobj = datetime.datetime.strptime(datestr,'%Y-%m-%d')
print dateobj
But what gets printed is: ...

20. convert an isoformat string to python datetime object    stackoverflow.com

Possible Duplicate:
How to parse ISO formatted date in python?
I have an isoformat datetime as a string like the example below -
'2011-05-31T04:35:33.127-05:00'
What is the best ...

21. How do I convert a string with a different time zone to a datetime object?    stackoverflow.com

I understand how to convert a string to a datetime object, but what about a string that has a different time zone? for example "10/07/2011 04:22 CEST"

22. Converting a string to datetime in python    stackoverflow.com

Possible Duplicate:
Parse date and format it using python?
i have a date string like 2011-07-15 13:00:00+00:00 . Any way to convert this string to a ...

23. Convert string into datetime type    stackoverflow.com

Possible Duplicate:
Convert Date String to DateTime Object in Python
Is there an easy way to convert the string the string 10/22/1984 into a datetime.date object? ...

24. Converting a String into a datetime object in python    stackoverflow.com

I have a string field like this..

2011-09-04 23:44:30.801000
and now I need to convert it to a datetime object in python so that I can calculate the difference between two datetime ...

25. Converting string to datetime object in Python (GAE)?    stackoverflow.com

I'm very new to Python, but I need to migrate a project from PHP to Python (running in GAE environment) and I need to move all data from one database to ...

26. python: difference of two timedate strings    stackoverflow.com

I have two date strings (taken from user input and can vary greatly)

s1 = '2011:10:01:10:30:00'
s2 = '2011:10:01:11:15:00'
I wish to find the difference between the two as minutes. How should I proceed ...

27. Obtain an aware datetime object out of a string    stackoverflow.com

Is there a way I can obtain a datetime aware object out of a string in Python using only the standard library modules ? I know that I can use dateutil.parser.parse, but ...

28. Converting string timestamp to Python datetime (was: how to properly convert char into float or double in Python)    stackoverflow.com

Here I have string like this "1322485986.672901000", data type is string which represents unixtime. I want to convert it into datetime in Python. The way I used is date = datetime.fromtimestamp(float(row[0])) row[0] ...

29. string to datetime    python-forum.org

mo = re_date.match(date) if mo: Y = int (mo.group(1)) m = int (mo.group(2)) d = int (mo.group(3)) H = int (mo.group(4)) M = int (mo.group(5)) ...

30. convert datetime to string    python-forum.org

31. turning datetime.dateime into string    python-forum.org

jaar = str(row.OpdrachtDatum.year) maand = str(row.OpdrachtDatum.month) dag = str(row.OpdrachtDatum.day) if len(maand) == 1: maand = '0' + maand if len(dag) ...

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.