To all,

The following program creates pretty date and time in American format.  To
use it, enter do read %file, where file is the name of the file in which
the program is stored.
I think the code is quite clear, but if you have any difficulties, I shall
be glad to explain further.

Jerry

date: function [][t d m]
[
   t: now/time
   t: fixtime reduce [t/1 t/2 t/3]
   d: join pick ['Monday 'Tuesday 'Wednesday 'Thursday 'Friday
                 'Saturday 'Sunday] now/weekday ","
   m: pick ['January 'February 'March 'April 'May 'June 'July 'August
            'September 'October 'November 'December] now/month
   Print [d m join now/day "," join now/year "," t]
]


fixtime: function [t][a]
[
   a: t/1
   if and (a < 12)(a > 0) [return join a [":" t/2 ":" t/3 " AM"]]
   if a > 12 [a: a - 12 return join a [":" t/2 ":" t/3 " PM"]]
   if a = 12 [return join 12 [":" t/2 ":" t/3 " PM"]]
   if a = 0 [return join 12 [":" t/2 ":" t/3 " AM"]]
]

Reply via email to