Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,870 questions

51,793 answers

573 users

How to get tomorrows date in COBOL

1 Answer

0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. TomorrowDate.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-TODAY-DATE     PIC 9(8).
01 WS-TOMORROW-DATE  PIC 9(8).
01 WS-DATE-INTEGER   PIC 9(8).

PROCEDURE DIVISION.
MAIN-PROCEDURE.
    *> Get today's date in YYYYMMDD format
    MOVE FUNCTION CURRENT-DATE(1:8) TO WS-TODAY-DATE

    *> Convert today's date into an integer
    MOVE FUNCTION INTEGER-OF-DATE(WS-TODAY-DATE) TO WS-DATE-INTEGER

    *> Add 1 to the integer to get tomorrow's date
    ADD 1 TO WS-DATE-INTEGER

    *> Convert the integer back into a date
    MOVE FUNCTION DATE-OF-INTEGER(WS-DATE-INTEGER) TO WS-TOMORROW-DATE

    *> Display tomorrow's date in YYYY-MM-DD format
    DISPLAY "Tomorrow's date is: "
        WS-TOMORROW-DATE(1:4) "-" 
        WS-TOMORROW-DATE(5:2) "-" 
        WS-TOMORROW-DATE(7:2).

    STOP RUN.




*> run:
*>
*> Tomorrow's date is: 2025-04-10
*>

 



answered Apr 9, 2025 by avibootz
edited Apr 9, 2025 by avibootz

Related questions

1 answer 177 views
177 views asked Aug 26, 2022 by avibootz
1 answer 191 views
2 answers 226 views
226 views asked Aug 26, 2022 by avibootz
1 answer 170 views
1 answer 68 views
1 answer 89 views
89 views asked May 18, 2025 by avibootz
...