---
title: "How to get Date and Time in CICS"
description: "How DATE and TIME captured during initiation of transaction in CICS. There is always standard way present to capture DATE and TIME in CICS programs. Read more."
url: https://srinimf.com/2015/04/17/cics-date-and-time-command/
date: 2015-04-17
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2021/09/pexels-photo-8346006.jpeg?fit=1880%2C1253&ssl=1
categories: ["CICS Tips"]
tags: ["CICS tips and Tricks", "DATE and Time in CICS"]
type: post
lang: en
---

# How to get Date and Time in CICS

When you are working on CICS, we need to obtain Date and Time from CICS terminals. When a [task is started](https://srinimf.com/2015/11/08/eibdate-in-cics-and-how-to-know-when-task-is-started-in-cics/), CICS will store these values in exec interface block fields like EIBDATE and EIBTIME.

When a task is started these fields will be updated with TIME and date.

**Also Read** | [How to modify VSAM file length in CICS](https://srinimf.com/2016/11/29/how-to-modify-vsam-file-length-best-way-in-cics/)

- ![COBOL Tough questions 1 of 3](https://i0.wp.com/srinimf.com/wp-content/uploads/2012/01/cobol-tough-questions-1-of-3.jpg?resize=1200%2C900&ssl=1)COBOL Tough questions 1 of 3
- ![COBOL 2 of 3 tough questions](https://i0.wp.com/srinimf.com/wp-content/uploads/2012/01/cobol-2-of-3-tough-questions.jpg?resize=1200%2C900&ssl=1)
- ![A man on the moon jokes](https://i0.wp.com/srinimf.com/wp-content/uploads/2019/04/a-man-on-the-moon-jokes.jpg?resize=1200%2C900&ssl=1)
- ![PLSQL engine](https://i0.wp.com/srinimf.com/wp-content/uploads/2014/08/plsql-engine.png?resize=1200%2C900&ssl=1)PLSQL engine

**Logic to get Date and Time in [CICS](http://www.indeed.com/jobs?indpubnum=6634974704162507&chnl=srinimf).**

The ASKTIME command will update DATE and TIME into EIBDATE and EIBTIME fields. Later we need to use FORMATTIME command to get Date and Time in format whatever way we want.

```
EXEC CICS
 ASKTIME [ ABSTIME(data-area) ] END-EXEC
```

ABSTIME command places DATE and TIME fields into local area.

**Also Read** | [The best way to handle file sharing in CICS](https://srinimf.com/2016/04/20/how-cics-rls-mode-handles-during-files-updates/)

**How to get DAY-OF-WEEK using below code**

This example shows how to obtain an absolute time and, using a FORMATTIME command, get the current day-of-week. ABSOLUTE-TIME is a 15-digit packed-decimal field (PIC S9(15) COMP-3), and DAY-OF-WEEK is a binary fullword (PIC S9(8) COMP).

```
0500-GET-DAY-OF-WEEK.  *  
EXEC CICS  ASKTIME ABSTIME(ABSOLUTE-TIME)  
END-EXEC.  
EXEC CICS  FORMATTIME ABSTIME(ABSOLUTE-TIME)  
DAYOFWEEK(DAY-OF-WEEK)  END-EXEC.
```

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2015%2F04%2F17%2Fcics-date-and-time-command%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2021%2F09%2Fpexels-photo-8346006.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=How%20to%20get%20Date%20and%20Time%20in%20CICS)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2015/04/17/cics-date-and-time-command/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2015/04/17/cics-date-and-time-command/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2015/04/17/cics-date-and-time-command/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2015/04/17/cics-date-and-time-command/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20to%20get%20Date%20and%20Time%20in%20CICS&body=https%3A%2F%2Fsrinimf.com%2F2015%2F04%2F17%2Fcics-date-and-time-command%2F&share=email)
-

### Like this:

Like Loading…
