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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mailmessage date

Status
Not open for further replies.

platp

Programmer
Oct 10, 2005
4
GR
Hi,
I writing an app that takes mails, parses them and put them in a db.
I am using PB 10.2 , MS sql server 2000 and connect using OLE DB.
Among others I have this piece of code

mailMessage msg
.
.
messagebox('date',msg.DateReceived)
.
dw_1.SetItem(ll_row, "date_registered", datetime(date(msg.DateReceived)))
.
.

When I run the app it stores 1900-01-01 00:00:00.000
although the messaebox above returns '2005/10/10 15:36'

(my regional codes are Greek dd/mm/yyyy.I changed it to yyyy/mm/dd but I have the same problem)

Any clues?
 
Verify the return values of both the date and datetime method calls to make sure they are doing what you think they are doing.

Matt

"Nature forges everything on the anvil of time
 
Well silly me!!

I changed the regional settings to yyyy/mm/dd and
when I have
dw_1.SetItem(ll_row, "date_registered", datetime(msg.DateReceived))
it gives me the following error
Microsoft OLE DB Provider for SQL Server
Invalid character value for cast specification.

when I have
dw_1.SetItem(ll_row, "date_registered", datetime(date(msg.DateReceived)))
it stores the date but the time is 00:00:000 (which is natural since I have converted the string to date).

Since the mailMessage has as date received this type of string (yyyy/mm/dd hh:mm) I thought to add a ':00' in the end and then convert the string to datetime but I get the error

Microsoft OLE DB Provider for SQL Server
Invalid character value for cast specification.

Is there a way to have the datetime correctly?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top