[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: convert excel date to valid date format

Subject: Re: convert excel date to valid date format
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Fri, 3 Jan 2014 16:18:47 +0100
Re:  convert excel date to valid date format
You can use this simple function:

<xsl:function name="wl:todate" as="xs:dateTime">
   <xsl:param name="days" as="xs:double"/>
   <xsl:value-of select="xs:dateTime('1900-01-01T00:00:00') +
xs:dayTimeDuration(concat('P',xs:integer($days),'D'))"/>
</xsl:function>

I'm not sure what the value returned by EXCEL actually means; if I run
41640.0 through this function, the result is 2014-01-03T00:00:00, but
this can be adjusted, of course.

-W

On 03/01/2014, henry human <henry_human@xxxxxxxx> wrote:
> Hi
> This XML is created by export of an EXCEL spreadsheet.
> (For the export of EXCEL data to XML I used the below the same XML structure
> such as the the XML file below as a schema too to use the mapping
> functionality of EXCEL as it is described by Microsoft tutorials)
>
>
> In the field received in the original EXCEL file the value for both record
> elements was January 01.01.2014 but after export it was automatically
> converted to 41640.0
>
> In Java I could convert the value with help of java.util.Calendar to the
> original value.
> Is it there a way converting the format in XSLT too?
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <data-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <record>
> <from>test@xxxxxxxxxxxxx</from>
> <subject>subject1</subject>
> <received>41640.0</received>
> </record>
> <record>
> <from>test@xxxxxxxxxxxxx</from>
> <subject>subject2</subject>
> <received>41640.0</received>
> </record>
> </data-set>
>
> BR
> henry

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.