TIP: Click on subject to list as thread! ANSI
echo: commo
to: FRED BRUCKER
from: JIM BENNETT
date: 1995-06-27 13:08:00
subject: Date Conversion Macro

Hi Fred,
 FB> Isn't Julian just YY/MM/DD?  You can tell {COMMO} to use that
 FB> format in the Setup File:
The problem I'm faced with is I want to trim my BBS callers.log by # of
days worth of entries, versus some arbitrary value such as filesize.
The CALLERS.LOG is a text file that would just continue to grow unless I
intervene either manually or automatically to trim old entries.  Entries
are stamped in the log with a "MM/DD/YY" string in the primary entry,
e.g., "Fred Brucker logged on at 14400bps on 06/27/95 at 14:23".  In
order to do what I need to do, I have to decrement "today" by whatever
number of days I want to keep on hand, read the .LOG looking for the
backdated target, and then trim off anything prior to the target.
Backdating is more easily done by manipulating the date as julian,
rather than trying to operate with MM/DD/YY, especially when you get
into the area of your target string falling into a previous month or
previous year.  Leap years only confound the situation :)  BTW,
Julian format is YY###, e.g., 01/01/95 is 95001.
FWIW, I've made pretty good progress on this macro.  I've worked out the
part that does the conversion to julian, determines the backdated target
(based on # of days worth of entries to keep), and then spits out the
new target string to look for in the .LOG in MM/DD/YY format.  I have
the "trim" routine done already in another macro I'm using (which is
not nearly as flexible on the "backdating" as this one).  All I need
to do is merge the two together. I'll post what I've got so far in
the next message.
When I'm done, I'll have a macro that can trim any .LOG that posts
entries in "MM/DD/YY" format, to any desired # of days (from "1",
i.e. 'just keep today', to 365).  And Leap Years will be accommodated
in the calculations.  Sysops are the most likely users of such a
thing, but plenty of other people have .LOG files, too..including all
the {COMMO} users who keep COMMO.LOG files .  I also plan to
expand the date format it'll support to DD/MM/YY, YY/MM/DD, MM-DD-YY,
DD-MM-YY, and whatever other formats I run across.
..just another example of how {COMMO} can do all sorts of odd jobs
for us Fred.  Thanks for making it so flexible.
Jim
                                                                              
            
--- JCQWK
---------------
* Origin: Meredith Place Mail Drop (1:300/15)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.