Cobol-Date Function (2of 2)

In Part-1 I have given Date and Time Format in COBOL how we get.

Interestingly, there are different date functions in COBOL. Let us see the conversions as below:

WS-DATE is any date example format is 01/01/0001

  • Convert from Gregorian to Integer formats

COMPUTE WS-INTEGER-DATE = FUNCTION INTEGER-OF-DATE (WS-DATE)

* Convert from Integer to Gregorian formats

COMPUTE WS-DATE = FUNCTION DATE-OF-INTEGER (WS-INTEGER-DATE)

* Convert from Julian to Integer formats

COMPUTE WS-INTEGER-DATE = FUNCTION INTEGER-OF-DAY (WS-JULIAN-DATE)

* Convert from Integer to Julian formats

COMPUTE WS-JULIAN-DATE = FUNCTION DAY-OF-INTEGER (WS-INTEGER-DATE)

I will add some more in my next posts. Bye untill then…

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.