On 1/07/2022 8:13 am, Paul Gilmartin wrote:
I tried this in Rexx.  I found it astonishingly hard to get "the end of the current 
month".
Would DFSORT do betteer?

I tried it in Java:

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class DateList
{
    public static void main(String[] args)
    {
        LocalDate today = LocalDate.now();
        LocalDate monthStart = LocalDate.of(today.getYear(), today.getMonth(), 1);
        LocalDate startDate = monthStart.minusMonths(2).plusDays(14);
        LocalDate endDate = monthStart.plusMonths(1);

        int count = 1;
        for (LocalDate date = startDate; date.isBefore(endDate); date = date.plusDays(1))
        {
System.out.format("('D%03d','%s','%s',%s,'%02d','%02d','%02d','%02d')%n",
                    count,
                    DateTimeFormatter.ISO_LOCAL_DATE.format(date),
                    DateTimeFormatter.BASIC_ISO_DATE.format(date),
                    DateTimeFormatter.BASIC_ISO_DATE.format(date),
                    date.getYear() / 100,
                    date.getYear() % 100,
                    date.getMonthValue(),
                    date.getDayOfMonth());
            count++;
        }
    }
}


--
Andrew Rowley
Black Hill Software

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to