DATE AND TIME

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DATE AND TIME

Robert L Hamilton
 
From this:
 
--Robert L Hamilton; May 2011
import java.util.Calendar
   cal = Calendar.getInstance()
   ampm = cal.get(Calendar.AM_PM) --> 1 then 'PM' else 'AM'
   am_pm = 'AM'
  IF ampm > 0 then am_pm = 'PM'  
--345678901234567890123456789012345678901234567890  
say Cal.getTime()' ' am_pm
index = Cal.get(Calendar.DAY_OF_WEEK);
say  '  index is = ' index;
say 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.subword(index,1);
say Cal.get(Calendar.DAY_OF_YEAR)' IS THE DAY  NBR OF THE YEAR '
 
 
I get this
 
Fri May 20 15:00:41 CDT 2011  PM
  index is =  6
Friday
140 IS THE DAY NBR OF THE YEAR
 
Wonder how far back the JAVA calendar function goes;  I wouldn't be surprised if it stopped at 1900.  In any case
the 400 year cycle of Gregory's calendar has 146097 days -- ( actually he didn''t invent it) -- and as far as anyone knows he has
never been considered for sainthood.  In real life he was probably an accountant/lawyer type dude. 
 
My first encounter with dates was a one card-column date field that had a problem with 1950. We fixed it so it
had a problem with - would you believe - 2000
 
Bob Hamilton
Richardson, Texas USA
 
 

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DATE AND TIME

alansam
Check the doc. For Java's GregorianCalendar, it is more customized and
offers the following (and I quote):

GregorianCalendar implements proleptic Gregorian and Julian calendars.
That is, dates are computed by extrapolating the current rules
indefinitely far backward and forward in time. As a result,
GregorianCalendar may be used for all years to generate meaningful and
consistent results. However, dates obtained using GregorianCalendar
are historically accurate only from March 1, 4 AD onward, when modern
Julian calendar rules were adopted. Before this date, leap year rules
were applied irregularly, and before 45 BC the Julian calendar did not
even exist.

It may satisfy your needs.

Alan.

On Friday, 20 May 2011, Robert Hamilton <[hidden email]> wrote:

>
> From this:
>
> --Robert L Hamilton; May 2011
> import java.util.Calendar
>    cal = Calendar.getInstance()
>    ampm = cal.get(Calendar.AM_PM) --> 1 then 'PM' else 'AM'
>    am_pm = 'AM'
>   IF ampm > 0 then am_pm = 'PM'
> --345678901234567890123456789012345678901234567890
> say Cal.getTime()' ' am_pm
> index = Cal.get(Calendar.DAY_OF_WEEK);
> say  '  index is = ' index;
> say 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.subword(index,1);
> say Cal.get(Calendar.DAY_OF_YEAR)' IS THE DAY  NBR OF THE YEAR '
>
>
> I get this
>
> Fri May 20 15:00:41 CDT 2011  PM
>   index is =  6
> Friday
> 140 IS THE DAY NBR OF THE YEAR
>
> Wonder how far back the JAVA calendar function goes;  I wouldn't be surprised if it stopped at 1900.  In any case
> the 400 year cycle of Gregory's calendar has 146097 days -- ( actually he didn''t invent it) -- and as far as anyone knows he has
> never been considered for sainthood.  In real life he was probably an accountant/lawyer type dude.
>
> My first encounter with dates was a one card-column date field that had a problem with 1950. We fixed it so it
> had a problem with - would you believe - 2000
>
> Bob Hamilton
> Richardson, Texas USA
>
>
>

--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Alan

--
Needs more cowbell.