Julian and Century date conversions

  • Follow


Wow.  Only 11 years after REXX date conversions came to VM, I've 
finally stumbled on a case where I need to convert dates to Julian 
and back.  Fortunately, on VM, there are conversions *from* Julian 
and Century dates to the formats supported by the language definition.

What if I were on some platform without those conversions, though?  
Is there some less cryptic way to go than converting via Basedays?

> JCDate: Procedure
>   Parse Arg format, days, jc
>   If format = '' then format = 'N'
>   If jc = 'C' then 
year = Left(Date('S'), 2) || '00'
>   Else Do /* default to 'J' */
>     Parse Var days year 3 days
>     year = Left(Date('S'), 2) || year
>   End
>   /* Add the previous 31 December's Basedays */
>   days = days + Date('B', year-1 || '1231', 'S')
> If Arg(4, 'E') then Return Date(format, days, 'B', Arg(4))
> Else Return Date(format, days, 'B')

�R
0
Reply Glenn 4/8/2008 4:59:45 AM

On Tue, 08 Apr 2008 00:59:45 -0400, Glenn Knickerbocker <NotR@bestweb.net>
wrote:
<47FAFBC1.C6EAFFBE@bestweb.net>

>Wow.  Only 11 years after REXX date conversions came to VM, I've 
>finally stumbled on a case where I need to convert dates to Julian 
>and back.  Fortunately, on VM, there are conversions *from* Julian 
>and Century dates to the formats supported by the language definition.
>
>What if I were on some platform without those conversions, though?  
>Is there some less cryptic way to go than converting via Basedays?
>
>> JCDate: Procedure
>>   Parse Arg format, days, jc
>>   If format = '' then format = 'N'
>>   If jc = 'C' then 
>year = Left(Date('S'), 2) || '00'
>>   Else Do /* default to 'J' */
>>     Parse Var days year 3 days
>>     year = Left(Date('S'), 2) || year
>>   End
>>   /* Add the previous 31 December's Basedays */
>>   days = days + Date('B', year-1 || '1231', 'S')
>> If Arg(4, 'E') then Return Date(format, days, 'B', Arg(4))
>> Else Return Date(format, days, 'B')
>
>�R


For platforms -without- adequate date conversion BUILTINs, basedays may be the
least cryptic route.  It's what I would choose given those circumstances.


One of these days I'll get you to explain why you're "not R".   That always
bothered me back at IBM.


(change Arabic number to Roman numeral to email)
0
Reply Frank 4/9/2008 3:13:31 AM


Frank Clarke wrote:
> For platforms -without- adequate date conversion BUILTINs, basedays may be the
> least cryptic route.

I was slowly coming to that sad conclusion.  I guess I'll stick that
routine away for future use!

> One of these days I'll get you to explain why you're "not R".

Or you could let http://users.bestweb.net/~notr/aol/whynot.r.html do it.

�R
0
Reply Glenn 4/9/2008 6:38:43 PM

On Wed, 09 Apr 2008 14:38:43 -0400, Glenn Knickerbocker <NotR@bestweb.net>
wrote:
<47FD0D33.68C5EFBF@bestweb.net>

>Frank Clarke wrote:
>> For platforms -without- adequate date conversion BUILTINs, basedays may be the
>> least cryptic route.
>
>I was slowly coming to that sad conclusion.  I guess I'll stick that
>routine away for future use!
>
>> One of these days I'll get you to explain why you're "not R".
>
>Or you could let http://users.bestweb.net/~notr/aol/whynot.r.html do it.
>
>�R

Hmmmm....   The one time I asked, your response was "It's long and complicated".
I see now the wisdom of that.


(change Arabic number to Roman numeral to email)
0
Reply Frank 4/9/2008 9:20:45 PM

3 Replies
483 Views

(page loaded in 0.093 seconds)

Similiar Articles:













7/23/2012 8:00:56 AM


Reply: