473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Date Conversion Query.

I need to convert a date that I receive from an Input Document
to output format

Input document date format is:
Expand|Select|Wrap|Line Numbers
  1. <SettlDt="2009-12-01">
  2.  
Output format should be:

Expand|Select|Wrap|Line Numbers
  1. 01 Dec 2009
  2.  
How can I convert from YYYY-MM-DD to DD-MM-YYYY?
Can anyone help please?

Thanks,
Apr 25 '07 #1
3 1521
I have solved the above query by creating my own template


Input Date Format:
2009-12-01

Output Date Format:
1 Dec 2009

Expand|Select|Wrap|Line Numbers
  1.      <xsl:template name="FormatDate">
  2.        <xsl:param name="Date" />
  3.  
  4.       <xsl:variable name="day">
  5.       <xsl:value-of select="substring($Date,9,10)" />
  6.       </xsl:variable>
  7.  
  8.       <xsl:variable name="mo">
  9.       <xsl:value-of select="substring($Date,6,2)" />
  10.        </xsl:variable>
  11.  
  12.     <xsl:variable name="year">
  13.       <xsl:value-of select="substring($Date,1,4)" />
  14.     </xsl:variable>
  15.  
  16.    <xsl:variable name="space">
  17.     <xsl:text> </xsl:text>
  18.    </xsl:variable>
  19.  
  20.     <xsl:choose>
  21.       <xsl:when test="$mo = 12">Dec</xsl:when>
  22.     </xsl:choose>     
  23.  
  24.       <xsl:value-of select="$day"/>
  25.       <xsl:value-of select="$space"/>
  26.       <xsl:value-of select="$mo"/>
  27.       <xsl:value-of select="$space"/>
  28.       <xsl:value-of select="$year"/>
  29.  
However,when I use the above,the date is returned as:

Expand|Select|Wrap|Line Numbers
  1. Dec01 12 2009
  2.  
Any idea why Dec is coming first?
Apr 25 '07 #2
I have solved the entire query.
All up and running.
Thanks,
Apr 25 '07 #3
dorinbogdan
839 Expert 512MB
Thank you for replying the solution.
It may help others too.

Dorin.
Apr 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ben | last post by:
I would like to use php to query a database and retrieve a unix timestamp. The problem is that mysql is storing the data in the date format and not a timestamp. I am sure that I can amend my...
4
by: Russell | last post by:
I'm having a fit with a query for a range of dates. The dates are being returned from a view. The table/field that they are being selected from stores them as varchar and that same field also...
7
by: Thomi Baechler | last post by:
Hello Everybody I run the following query against to identical databases. Execution time on the first DB is 0 seconds, on the other 6 seconds! SELECT dbo.HRMABZ.EMPKEY ,...
1
by: michael montagne | last post by:
I have a delimited text file that has a column of dates in the form 2003-10-11 10:24:53. I can't get past a type conversion error when atempting to import this into a date/time column.
2
by: Giulio | last post by:
I make an import of a huge file txt table with headers at each page and date format as "20.12.2004" in order to use the data I first qo a query that exclude all line representing the headers...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
4
by: Annie D via AccessMonster.com | last post by:
Problem! I have a series of CSV files that I am bringing in to Access, contained within each of them are 6 date fields, however, they are not being recognized as dates…this is a big problem!...
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" &...
2
by: p.smachylo | last post by:
Hello, I am relatively new to Microsoft Access and databases in general, and have a problem - one which I think may necessitate some VBA code (or maybe just modification of the criteria section of...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.