Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting string to a datetime

Status
Not open for further replies.
Joined
Sep 29, 2003
Messages
28
Location
BY
Hi all!
I'm using CR9 and MS SQL Server. My report has two string parameter fields {?DateBegin}
and {?DateEnd}. Parametrs are passed as strings with default format("dd.mm.yyyy hh:mm:ss"). When parameters are passed to a report I try to convert them to datetime (datetime function) and to pass to SQL server. But if in the regional settings the default date format "dd/mm/yyyy hh:mm:ss PM",
an error occurs "Bad date format string". How can I convert a stirng to a datetime with predifend format?
Thanks for help!
 
Why not use Date:time format for the parameters, then no conversion is required?

BurnsORegan
 
There must be something else wrong...I ran a query on my SQL Server and it converted the 03.09.2004 12:00:00 to DATETIME just fine.

Do you verify that the parameters are actually valid dates and times?

-SQLBill
 
2 SQLBill:
and what is your system datetime format? This error occurs when system datetime format differs from "dd.mm.yyyy hh:mm:ss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top