473,378 Members | 1,500 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

trouble with time --again

Hey there,
could someone show me where i am going wrong here?
date1 = '2005-01-01 8:20:00'
date1 = strptime('%Y-%m-%d %H:%M:%S',date1)


raise ValueError("time data did not match format: data=%s fmt=%s" %
ValueError: time data did not match format: data=%Y-%m-%d%H:%M:%S
fmt=2005-01-01 8:20:00

i have looked over the strptime and strftime over and over, dont get
where i am missing it here.

thanks

Aug 30 '05 #1
5 1369
On 30 Aug 2005 10:42:41 -0700, ne*****@xit.net <ne*****@xit.net> wrote:
Hey there,
could someone show me where i am going wrong here?
date1 = '2005-01-01 8:20:00'
date1 = strptime('%Y-%m-%d %H:%M:%S',date1)
raise ValueError("time data did not match format: data=%s fmt=%s" %
ValueError: time data did not match format: data=%Y-%m-%d%H:%M:%S
fmt=2005-01-01 8:20:00


Try:
date1 = strptime(date1, '%Y-%m-%d %H:%M:%S')


I think you have the data and format strings swapped.

--
Kristian

kristian.zoerhoff(AT)gmail.com
zoerhoff(AT)freeshell.org
Aug 30 '05 #2
OH my god.
youre right.
i feel like a complete idiot.
thanks

Aug 30 '05 #3
On 30 Aug 2005 10:54:29 -0700, ne*****@xit.net <ne*****@xit.net> wrote:

i feel like a complete idiot.


Now don't go and do that. Mistakes happen.

--
Kristian

kristian.zoerhoff(AT)gmail.com
zoerhoff(AT)freeshell.org
Aug 30 '05 #4
he he. yep, just spent a lot of time on this one.
life moves on.
cheers!
sk

Aug 30 '05 #5
Hi !
Try :

import datetime
date1 = datetime.datetime(2005,01,01,8,20,0)
print date1.strftime('%Y-%m-%d %H:%M:%S')

@-salutations

Michel Claveau
Aug 31 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Gerry | last post by:
I want this to show plus (+) 6 hours: $ftanggal=date("d M Y - H:i", (date("U"))); How? /Gerry
12
by: José | last post by:
I'm programming a simple script to calculate response time from one server to another server. I put the time in secons in a variable. I take the web, and I take the time again, the difference is...
1
by: DAVID | last post by:
Hello, With regards to the Connect dialog on Oracle forms 6i via which we can connect to Oracle database, should we use the same functionality on forms run time again? I mean, I want to make a...
5
by: lkrubner | last post by:
Go to this page: http://www.publicpen.com/designer/mcControlPanel.php?arrangement=createweblogsForm.php You'll need to login, use these: username: designer password: designer123 This is...
11
by: srkkreddy | last post by:
Hi, I have written a large program which makes multiple calls to number of functions (also written by me) of the program. Now, I want to know the collective time taken by all the calls to a...
1
by: Michael Evanchik | last post by:
im trying to do a get on a http server and keep appending the return data to a string and then i even tried an array of strings. But very odd things are happening. I am completely missing the...
6
by: Mark Rae | last post by:
Hi, I'm busy implementing a PayPal solution at the moment, part of which involves adding the PayPal transaction information to SQL Server for fulfillment, stock management etc. PayPal provides...
8
by: Mark | last post by:
hi, how might I convert a string like "5p" or "5pm" or "5:00p" or "5.00pm" etc.. to "17:00:00" (24-hour time) I want it so that it's really *NOT* picky and will accept just about anything as...
2
by: Lancelot | last post by:
Hello everyone. This is my first post here, but I've been looking for answer many time. I have a crazy idea in my head and since I am quite a newby to python, I am not sure where to start or if...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.