Thanks Hugh! I'll see what's easiest... Im just pounding a statistic analysis and this date problem really threw teh curve ball on me!
Thanks for the function! I'd rather keep the standard routines though (i have lots of calculations for those already), and we only have files from this and the last century fortunately. However for some bizareness we have some that are dated before the computer age which is quite fantastic to say the least! ;)) Cheers Xavier On 09.03.2005 18:01:03 use-revolution-bounces wrote: >> convert "01/03/1937" to dateitems >> I got invalid date ;( >> >> Maybe we should switch to stardate ;)) > >I can't offer Stardate to you, but Julian dates handle the number of days >since noon 4713 BC January 1. These were posted by [EMAIL PROTECTED] >(mailto:[EMAIL PROTECTED]) on 16 Apr 2004 and may provide you with the >tools... At least they avoid the 'invalid date' syndrome! > > > > >/* date.julian return the julian count, i.e. days since 24.11.-4713 >@param d is the day >@param m is the month >@param y is the year >@returns is the julian count >*/ >function date.julian d,m,y >return (1461*(y+4800+(m-14) div 12)) div 4+(367*(m-2-12*((m-14) div 12))) >div 12-(3*((y+4900.0+(m-14) div 12) div 100)) div 4+d-32075 >end date.julian > >Example: >answer date.julian 13,11,2001 > > >/* get date.julian2DayOfWeek(aJulian) >@purpose Returns the day of the week according to: 1..7 for Sunday..Saturday >@param aJulian is the julian number. >*/ >function date.julian2DayOfWeek aJulian >-- // returns 1..7 for Sunday..Saturday >return (aJulian+1) mod 7 + 1 >end date.julian2DayOfWeek > >Example: >answer date.julian2DayOfWeek 2452227 > > >/* date.julian2DMY aJulian,@d,@m,@y >@purpose Set the day, month year according to the julian date aJulian. >*/ >on date.julian2DMY aJulian,@d,@m,@y >put aJulian + 68569.0 into l >put ( 4 * l ) div 146097.0 into n >put l - ( 146097.0 * n + 3 ) div 4 into l >put ( 4000.0 * ( l + 1 ) ) div 1461001.0 into i -- (that's 1,461,001) >put l - ( 1461 * i ) div 4 + 31 into l >put ( 80 * l ) div 2447.0 into j >put l - ( 2447.0 * j ) div 80 into d -- day >put j div 11 into l >put j + 2 - ( 12 * l ) into m -- month >put 100 * ( n - 49 ) + i + l into y -- year >end date.julian2DMY > >Example: >date.julian2DMY 2452227,d,m,y >answer d,m,y > > >/H > >Hugh Senior >The Flexible Learning Company >Web: _www.FlexibleLearning.com_ (http://www.flexiblelearning.com/) >E: [EMAIL PROTECTED] (mailto:[EMAIL PROTECTED]) >T/F: +44(0)1483.27 87 27 >_______________________________________________ >use-revolution mailing list >[email protected] >http://lists.runrev.com/mailman/listinfo/use-revolution ----------------------------------------- Visit us at http://www.clearstream.com IMPORTANT MESSAGE Internet communications are not secure and therefore Clearstream International does not accept legal responsibility for the contents of this message. The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Any views expressed in this e-mail are those of the individual sender, except where the sender specifically states them to be the views of Clearstream International or of any of its affiliates or subsidiaries. END OF DISCLAIMER _______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
