Results 1 to 8 of 8

Thread: Yet another date finder

  1. #1

    Yet another date finder

    Petr:

    Attached is another version of my previous "date finder" program, RETURN_DATES.

    This one takes any date that is entered, for example May 18 2009 (a Monday), and finds all future May 18ths that also fall on the same weekday, Monday.

    Don
    Attached Files Attached Files
    XPS 1710

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Yet another date finder

    Thanks!,

    very useful. Maybe the days, if not too many, could be outputted both directly to console and file.
    Interesting to see next May 18th is in 2015


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3

    Re: Yet another date finder

    Petr:

    Good idea.

    Attached version displays up to the first 10 return dates on the console while writing the complete list to the output file.

    Don
    Attached Files Attached Files
    XPS 1710

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Yet another date finder

    Very nice,

    thank you for new version!
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5

    Re: Yet another date finder

    Petr:

    Attached is a revised version of the RETURN_DATES program.

    I found a small logic error in the previous ones that caused the program to miss some return dates. I had missed including one of the date return periods. It is fixed now.

    I tried sending this post earlier this AM, but apparently my message got lost in the system.

    Don
    Attached Files Attached Files
    XPS 1710

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Yet another date finder

    Thanks Don,

    here is is bonus ChkInput function for you - it writes red warning in case of incorrect input, and then it correctly restores original color, whatever it was.
    [code=thinbasic]
    FUNCTION ChkInput(sRequest AS STRING, minValue AS LONG, maxValue AS LONG) AS LONG
    '*********************************
    ' Petr's input validation function
    '*********************************

    DIM AS LONG tempVal, secondTry, textAttr

    tempVal = 0
    DO
    IF secondTry THEN
    ' -- Retrieving original settings
    textAttr = Console_GetTextAttribute()

    ' -- Print red
    Console_SetTextAttribute(Console_ForegroundRGB(1,0,0,1))
    PRINTL
    PRINTL STRFORMAT$("Please enter value between {1} and {2}:", minValue, maxValue )

    ' -- Reseting original settings
    Console_SetTextAttribute(textAttr)
    END IF

    PRINT (sRequest)
    tempVal = VAL(CONSOLE_READ())
    secondTry = %TRUE
    LOOP WHILE outside(tempVal, minValue, maxValue)

    FUNCTION = tempVal
    END FUNCTION
    [/code]


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #7

    Re: Yet another date finder

    Petr:

    Many thanks; I give it a try.

    Don
    XPS 1710

  8. #8

    Re: Yet another date finder

    Petr:

    You'r modification makes things more colorful and attention-getting!

    Don
    Attached Files Attached Files
    XPS 1710

Similar Threads

  1. Fast Friday the 13th finder
    By GSAC3 in forum Shout Box Area
    Replies: 15
    Last Post: 18-02-2009, 22:53

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •