ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problems parsing dateTime string with format including AM/PM

Post new topic  Reply to topic
 Problems parsing dateTime string with format including AM/PM « View previous topic :: View next topic » 
Author Message
eskil
PostPosted: Fri May 08, 2009 1:18 am    Post subject: Problems parsing dateTime string with format including AM/PM Reply with quote

Novice

Joined: 25 Nov 2008
Posts: 14

Hi.

I'm using the XMLNSC domain and wants to parse a dateTime string into a TIMESTAMP. This so I later on can cast it to other formats.

But, I'm having problem with the AM/PM string in the dateTime string.
Here's an example of the string: '1/19/2008 8:32:45 AM'

This is how my code looks like:
Code:

DECLARE TransferDateString CHARACTER;
DECLARE TransferDate TIMESTAMP;
DECLARE DateString CHARACTER;
DECLARE TimeString CHARACTER;
      
SET TransferDateString = '1/19/2008 8:32:45 AM';
SET TransferDate = CAST(TransferDateString AS TIMESTAMP FORMAT 'M/dd/yyyy h:mm:ss a');

SET DateString = CAST(CAST(TransferDate AS DATE FORMAT 'yyyyMMdd') AS CHARACTER);
SET TimeString = CAST(CAST(TransferDate AS TIME FORMAT 'HH:mm:ss') AS CHARACTER);


When running the code I get an exception: "No am / pm here"
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 08, 2009 2:40 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Why do you need a format when you cast a timestamp to a date?
Why do you need a format when you cast a timestamp to a time?

Check how your parentheses are set...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
eskil
PostPosted: Fri May 08, 2009 2:58 am    Post subject: Reply with quote

Novice

Joined: 25 Nov 2008
Posts: 14

Yes you are correct, you don't need to cast it twice. *changing the code*

Still the problem is in the first cast.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 08, 2009 3:02 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

eskil wrote:
Yes you are correct, you don't need to cast it twice. *changing the code*

Still the problem is in the first cast.

Verify your format string using the manual.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
eskil
PostPosted: Fri May 08, 2009 3:18 am    Post subject: Reply with quote

Novice

Joined: 25 Nov 2008
Posts: 14

Done it trice already.. Everything works if I remove 'a' from the format string and AM/PM from the dateTime string.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problems parsing dateTime string with format including AM/PM
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.