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 » CAST AS TIMESTAMP CLARIFICATION

Post new topic  Reply to topic
 CAST AS TIMESTAMP CLARIFICATION « View previous topic :: View next topic » 
Author Message
mpong
PostPosted: Mon Nov 02, 2015 2:58 am    Post subject: CAST AS TIMESTAMP CLARIFICATION Reply with quote

Disciple

Joined: 22 Jan 2010
Posts: 164

Hi All,

Below code returns 12/31/2000 but input value is 12/31/1999, please suggest if I missed out something on the below statement.

DECLARE TS CHARACTER CAST (CAST( '12/31/1999' AS TIMESTAMP FORMAT 'MM/dd/YYYY') AS CHARACTER FORMAT 'MM/dd/YYYY');
Back to top
View user's profile Send private message
maurito
PostPosted: Mon Nov 02, 2015 3:06 am    Post subject: Re: CAST AS TIMESTAMP CLARIFICATION Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

mpong wrote:
Hi All,

Below code returns 12/31/2000 but input value is 12/31/1999, please suggest if I missed out something on the below statement.

DECLARE TS CHARACTER CAST (CAST( '12/31/1999' AS TIMESTAMP FORMAT 'MM/dd/YYYY') AS CHARACTER FORMAT 'MM/dd/YYYY');


it is returning what you asked for: CHARACTER FORMAT 'MM/dd/YYYY'

and you should be using yyyy ( lowercase ),
see: Formatting and parsing dateTimes as strings for the difference between YYYY and yyyy
Back to top
View user's profile Send private message
mpong
PostPosted: Mon Nov 02, 2015 7:43 am    Post subject: Reply with quote

Disciple

Joined: 22 Jan 2010
Posts: 164

Thank you.
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 » CAST AS TIMESTAMP CLARIFICATION
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.