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 » Convert YYYY-MM-DD (Dateformat) to dd/MM/yyyy (Date Format)

Post new topic  Reply to topic
 Convert YYYY-MM-DD (Dateformat) to dd/MM/yyyy (Date Format) « View previous topic :: View next topic » 
Author Message
nukalas2010
PostPosted: Wed Jan 07, 2015 5:43 am    Post subject: Convert YYYY-MM-DD (Dateformat) to dd/MM/yyyy (Date Format) Reply with quote

Master

Joined: 04 Oct 2010
Posts: 220
Location: Somewhere in the World....

Dears,
I am trying to cast of date fro one format to another, but ended up without solution

Code:
Source -- DateFormat - YYYY-MM-DD
Target -- DateFormat - dd/MM/yyyy


Can anybody throw some light on this..

I can able to achieve if its from Date to Character in the same format. but not from Date to Date.

Thanks in Advance,
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jan 07, 2015 5:49 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Dates don't have formats.

Dates can be formatted into strings, or strings can use formats to extract information to populate a Date.

Dates don't have formats.
Back to top
View user's profile Send private message
nukalas2010
PostPosted: Wed Jan 07, 2015 6:00 am    Post subject: Reply with quote

Master

Joined: 04 Oct 2010
Posts: 220
Location: Somewhere in the World....

mqjeff wrote:
Dates don't have formats.


Could you please elaborate on this.. Eg: dd-MM-YYYY, dd/mm/yyyy are not examples of date format. ???

Code:
Dates can be formatted into strings, or strings can use formats to extract information to populate a Date.


Yes, we can format to strings or vice versa. But not date to date.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jan 07, 2015 6:04 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The ESQL date, datetime, time, and etc. etc. etc have internal representations.

They hold the VALUE of the date, which has no format at all.

So it doesn't hold a value of "7/1/2015", it holds the VALUE that represents that date.

So it is meaningless to try and cast a Date object from one format to another, since dates have no format.

There's no more elaboration I can give on that. Dates have no format.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jan 07, 2015 6:07 am    Post subject: Reply with quote

Grand High Poobah

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

On a more practical sense for your quandry:
  1. cast string to date using format
  2. cast date to string using format
  3. conversion complete


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nukalas2010
PostPosted: Wed Jan 07, 2015 6:22 am    Post subject: Reply with quote

Master

Joined: 04 Oct 2010
Posts: 220
Location: Somewhere in the World....

hmm its clear.. Thanks jeff
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jan 07, 2015 6:27 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

nukalas2010 wrote:
Could you please elaborate on this.. Eg: dd-MM-YYYY, dd/mm/yyyy are not examples of date format. ???


No, they're formatted representations of dates. A date variable is typically expressed as an integer number of seconds or milliseconds from an arbitrary date. The fact that (for example) a DATE column in a database looks like one of the formats you show when viewed through an explorer type tool doesn't change how it's held internally. The fact that a DATE literal is expressed in ESQL as a formatted string for the convienience of the developer doesn't change this.

A noteable exception to this (and one which I think may be relevant for you) is an XML document where an xsd:date is a text item formatted as yyyy-mm-dd. So that is the representation of a date. If however you look at (for example) the Java representation of a parsed XML document with an xsd:date, you won't see that string, you'll see the Java implementation (which is an int) with an implausibly high number.

So you can't "format" a date. You can format a string representation of a date.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jan 07, 2015 6:32 am    Post subject: Reply with quote

Grand High Poobah

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

Sorry Vitor. Java Calendar information (date, time etc...) is usually a long not an int...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Jan 07, 2015 6:36 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
Sorry Vitor. Java Calendar information (date, time etc...) is usually a long not an int...


Ok, it's a long. Which is a 64 bit integer. It's still not represented in Java as a formatted string.....

...grumble grumble....

...wretched Java......
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Convert YYYY-MM-DD (Dateformat) to dd/MM/yyyy (Date Format)
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.