XSLT Function to get julian day of the year - InfoPath Dev
in

InfoPath Dev

XSLT Function to get julian day of the year

Last post 01-05-2011 07:20 AM by KansasCoder. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-01-2010 08:52 AM

    XSLT Function to get julian day of the year

    I just started in InfoPath yesterday and I've nver worked with Julian Dates so bear with me if this is covered all over the web. I wasn't able to find anything.

     

    I am working in InfoPath 2007. I have a field which I need to auto populate with a numeric value with YYYY + day of the year in Julian.

    Is there an xslt function that cane take the current system date as an input and kick back the julian day part of the result?

     Thank yoU!

    Love them ALL...regardless.
  • 10-01-2010 08:54 AM In reply to

    Re: Function for working with julian dates

    I figured it out. In case anyone else needs this odd requirement fulfilled here is the way to do it in XSLT:

     (substring-before(substring-after(substring-after(now(), "-"), "-"), "T")) + floor((153 * ((substring-before(substring-after(now(), "-"), "-")) + 12 * (floor((14 - substring-before(substring-after(now(), "-"), "-")) / 12)) - 3) + 2) / 5) + (substring-before(now(), "-") + 4800 - (floor((14 - substring-before(substring-after(now(), "-"), "-")) / 12))) * 365 + floor((substring-before(now(), "-") + 4800 - (floor((14 - substring-before(substring-after(now(), "-"), "-")) / 12))) / 4) - floor((substring-before(now(), "-") + 4800 - (floor((14 - substring-before(substring-after(now(), "-"), "-")) / 12))) / 100) + floor((substring-before(now(), "-") + 4800 - (floor((14 - substring-before(substring-after(now(), "-"), "-")) / 12))) / 400) - 32045

    This will round up the ones place. 

     Optimizations are welcome!

    Love them ALL...regardless.
  • 01-05-2011 07:20 AM In reply to

    Re: Function for working with julian dates

    If interested more on this, including a SQL Server UDF, is available my tiny blog

    Love them ALL...regardless.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.