MainframeMaster

Mainframe date converter

Paste a Gregorian date, COBOL Julian (YYDDD / YYYYDDD), CYYDDD, Lilian day number, or STCK hex. You get the other forms for the same calendar day, leap-year and day-of-year notes, a midnight-UTC STCK, and a small INTEGER-OF-DAY / DATE-OF-INTEGER snippet.

How to use it

  1. Choose the format you have (Gregorian is the default).
  2. Enter the value. For YYDDD, set the century window to match your shop if the year looks wrong.
  3. Read every derived form below. Copy the COBOL snippet when you need intrinsic-function wiring.

Runs in your browser. Nothing is uploaded.

Mainframe date converter

Presets
YYYY
MM
DD

Gregorian

2026-12-04

Weekday

Friday

Day of year

338

Leap year

No

YYDDD

26338

YYYYDDD

2026338

CYYDDD

126338

YYYYMMDD

20261204

Lilian day

162,219

ANSI integer

155,566

STCK at 00:00:00.000000 UTC for this calendar day (low 12 bits zeroed):

E3AD3D7624000000

COBOL intrinsic snippet

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
*> Julian day-of-year (YYYYDDD) ↔ integer date *> INTDATE(ANSI): day 1 = 1601-01-01 *> INTDATE(LILIAN): day 1 = 1582-10-15 (LE CEEDAYS) COMPUTE WS-INT = FUNCTION INTEGER-OF-DAY(2026338) COMPUTE WS-YYYYDDD = FUNCTION DAY-OF-INTEGER(WS-INT) *> Gregorian YYYYMMDD ↔ integer date COMPUTE WS-INT = FUNCTION INTEGER-OF-DATE(20261204) COMPUTE WS-YYYYMMDD = FUNCTION DATE-OF-INTEGER(WS-INT) *> This calendar day: *> Lilian day ........ 162219 *> ANSI integer ...... 155566 *> YYYYDDD ........... 2026338

Need this at work?

Free account saves tutorial progress. The jobs board lists openings that ask for JCL.

COBOL jobs on the board

Formats this tool understands

  • Gregorian / YYYYMMDD: normal calendar date, or eight digits like 20261112.
  • YYDDD: two-digit year + day of year (001–366). Needs a century window.
  • YYYYDDD: four-digit year + day of year. What COBOL ACCEPT … FROM DAY YYYYDDD returns.
  • CYYDDD: century digit + YY + day of year. C=0 → 19yy, C=1 → 20yy.
  • Lilian: day count with day 1 = 1582-10-15 (Language Environment).
  • STCK / STCKE: TOD clock hex. Treated as UTC. Output also shows midnight UTC STCK for the calendar day.

Julian day-of-year (not “Julian Day Number”)

Mainframe “Julian date” usually means day-of-year: January 1 is 001, December 31 is 365 or 366. That is not the astronomical Julian Day Number used in astronomy. COBOL FROM DAY and many VSAM/SMF fields use the day-of-year form.

cobol
1
2
3
ACCEPT WS-YYDDD FROM DAY ACCEPT WS-YYYYDDD FROM DAY YYYYDDD * Example: 12 Nov 2026 → YYDDD 26316, YYYYDDD 2026316

CYYDDD century digit

C is added to 19 to form the century. Years 1900–1999 use C=0; 2000–2099 use C=1; 2100–2199 would use C=2. Packed fields sometimes store this as seven digits with a leading zero and a sign nibble (0CYYDDD + sign). Paste either the six-digit CYYDDD or a seven-digit value starting with 0.

  • 098185: 1998, day 185 → 4 July 1998
  • 100001: 2000, day 1 → 1 January 2000
  • 126316: 2026, day 316 → 12 November 2026

Lilian vs ANSI integer dates

Language Environment Lilian days start at 15 October 1582. COBOL's default INTDATE(ANSI) integer dates start at 1 January 1601. INTDATE(LILIAN) makes INTEGER-OF-DATE / DATE-OF-INTEGER (and the DAY variants) use the Lilian epoch instead. This page always shows both numbers so you can see the gap.

STCK notes

Per z/Architecture, the TOD clock advances so bit 51 is one microsecond. The 8-byte STCK value is microseconds since 1900-01-01 00:00:00 UTC, shifted left by 12 bits (low bits hold sub-microsecond / CPU identity noise). Conversion here assumes UTC. Your LPAR's local time is UTC plus the system offset. Prefer STCKE when you need dates past the 2042 wrap of classic STCK.

Quick check (IBM example)

IBM documents Lilian day 148138 as 16 May 1988. Paste 148138 with input format Lilian and confirm the Gregorian result.

Explain it like I'm 5

A calendar date is one day on the wall calendar. YYDDD and YYYYDDD count which day of the year that is (day 1 is January 1). Lilian counts how many days since the Gregorian calendar started. STCK is the computer's stopwatch since 1900, in tiny ticks. This page translates between those spellings of the same day.

FAQ

Related Pages

More detail

Walk through ACCEPT and intrinsic functions in the dates and time tutorial. Day-of-year specifics are in the DAY quick reference. For SORT date fields see DFSORT date conversion.