1
votes

i have date showing like the following

01-Nov-2012 12:00:00 AM

and i want to show the if the date is like above than

01-Nov-2012

this comes for few data only not for all,

How to do this in Xquery.

Please help

Regards

3

3 Answers

1
votes

This will work:

fn:replace("01-Nov-2012 12:00:00 AM", "\s.*", "")

It replaces the space and everything after with the empty string.

1
votes

You could use either:

tokenize(/test,' ')[1]

or

substring-before(/test,' ')

With /test being replaced with the appropriate path to the date.

-1
votes

It is so simple.

convert(VARCHAR(10),datetoformate,106)

thats it