• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

user-defined date format in XML schema

 
iyven koh
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can i define my own date format for data-type "date" in Schema? i know that the default format is CCYY-MM-DD, but i want my date format to be DD/MM/CCYY. how can i do that in order to validate the date in xml?
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can do what you want....ie; DD/MM/CCYY.
That may be possible with the schema but I will have to get back on "if so how" part of your post....
Haven't read everything on this link, but follow
this link, which is a discussion on the date.
http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#date
- madhav.....polishing that rusted portion of my brain!
[ July 01, 2003: Message edited by: Madhav Lakkapragada ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think changing the format of an element or attribute declared as type 'xsdate' data type is possible. When an element or attribute is defined as 'type' 'xsdate', the xml processor tries to validate the date in the xml document against the format CCYY-MM-DD.
I havent tried it out practically..any one who did that?
U have to write ur own custom code to achive the format DD/MM/CCYY by 'restricting' a 'string' data type.
[ July 02, 2003: Message edited by: Madhav Lakkapragada ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think changing the format of an element or attribute declared as type 'xsdate' data type is possible
Sorry, my mistake for not being very clear.....
I was hoping the Schema would provide some "format selection" attribute or something. That's what I was hoping for, didn't mean to suggest that we can change the schema type itself.
Anyways, as I said I didn't read the entire date explanation....
- madhav
[ July 02, 2003: Message edited by: Madhav Lakkapragada ]
 
iyven koh
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there's no attribute that i can use to customise the format of date to what i want. i think the only way is write the code as what you have suggested but it is a bit tedious. coz i have to verify whether it is a valid date eg.30/2/2003 is invalid. anybody has written the code before?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic