This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: date calculation from Excel 1900 Format
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] date calculation from Excel 1900 Format
- From: Xiaocun Xu <xiaocunxu at yahoo dot com>
- Date: Mon, 11 Jun 2001 20:07:46 -0700 (PDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi, Goetz:
Thanks for the offer to help, much appreciated.
I could not seems to find an established algorithm
to derive date from the "1900 format", I would be much
appreciate if anyone has seen one.
The way I thought I might want to approach it (if I
need to build my own) would be:
Assume t as total number of dates since 1/1/1900
1. find divisor and remainder of t/(366+365+365+365).
This is scope t down to a 4-years span including a
leap year.
2. with the remainder, minus 366,365,365,365 in that
order until result is negative, that scopes t to a
particular year.
3. with the last positive remainder, remove number of
days from each month starting with 31 days in Jan. to
scope t into a particular month, and eventually
particular day within the month.
As you can see, it is not pretty, and not completely
correct. The correct way to count leap year is 1 in
every 4, except every 100 and include every 400. But
I only care recent days and therefore this minor
mistake can be ignored.
Is there any simpler algorithm?
Much thanks,
Xiaocun
--- Goetz Bock <bock@blacknet.de> wrote:
>
> On Mon, Jun 11 '01 at 11:50, Xiaocun Xu wrote:
> > Has anyone did date conversion calculation, esp.
> > Excel 1900 format, with XSL?
> Do you happen to have a conversion algorithm in any
> other programming
> language, or even an informal description?
>
> I don't have the time to search the web for a
> conversion algorithm, but
> I will help you to transfer it to XSLT.
>
> Goetz.
>
> ATTACHMENT part 2 application/pgp-signature
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list