[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

1399.0. "Date of "Next Monday"??" by LARVAE::JORDAN (Chris Jordan, TSE - Technology Services, End-User Computing) Fri Sep 11 1992 16:21

    A prize (well, maybe not - just a quick THANKS) awaits the best bit of
    ALL-IN-1 script code that can identify the date of "Next Monday".
    
    Is there a quicker way of doing it than: take todays date, add 1,
    do a DATE_CONVERT, check to see if it is a MONDAY, if not add 1 and
    re-check.
    
    Cheers, Chris
T.RTitleUserPersonal
Name
DateLines
1399.1finding days of the weekSHALOT::LAMPSONStill here ... and waiting...Fri Sep 11 1992 18:0322
        The following code sets the symbols #SETS_DATE and $SETS_DATE with
        the date of the nearest Saturday (for an timesheet application). 
        If you are looking for the next Monday, change the offsets to
        +1,0,+6,+5,+4, +3,+2 respectively.
        
        This code is an enhancement from an example I got from Jack
        Creamer.
        
        _Mike
        
GET OA$FUNCTION = "GET #SETSOFFSET" OA$_DAY_OF_WEEK_1::1 " = '-1'"\
GET OA$FUNCTION = "GET #SETSOFFSET" OA$_DAY_OF_WEEK_2::1 " = '-2'"\
GET OA$FUNCTION = "GET #SETSOFFSET" OA$_DAY_OF_WEEK_3::1 " = '-3'"\
GET OA$FUNCTION = "GET #SETSOFFSET" OA$_DAY_OF_WEEK_4::1 " = '-4'"\
GET OA$FUNCTION = "GET #SETSOFFSET" OA$_DAY_OF_WEEK_5::1 " = '+2'"\
GET OA$FUNCTION = "GET #SETSOFFSET" OA$_DAY_OF_WEEK_6::1 " = '+1'"\
GET OA$FUNCTION = "GET #SETSOFFSET" OA$_DAY_OF_WEEK_7::1 " = '+0'"\
DATE_CONVERT #SETS_DAYOFWEEK,OA$DATE_FULL,5\
GET OA$FUNCTION = 'GET #SETS_DATE_STRING = OA$_TM_SETDATE_TODAY " "
  #SETSOFFSET' #SETS_DAYOFWEEK ' OA$_TM_SETDATE_D'\
DATE_CONVERT #SETS_DATE,#SETS_DATE_STRING,2\
GET #NULL = CAL$SET_DATE:"$SETS_DATE".%WHOLE[#SETS_DATE]