current date,time

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
amar
Member
Posts: 4
Joined: Sat Oct 07, 2006 9:43 am

current date,time

Post by amar » Sat Oct 07, 2006 10:13 am

can n e 1 plz tell me , how to take current date and current time in db2 queries

also how to autogenerate ...............

ovreddy
Member
Posts: 14
Joined: Sat Oct 07, 2006 4:13 pm
Location: Chennai
Contact:

Post by ovreddy » Sat Oct 07, 2006 4:17 pm

---------+---------+---------+---------+---------+---------
SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1;
---------+---------+---------+---------+---------+---------

---------+---------+---------+---------+---------+---------
10/07/2006
DSNE610I NUMBER OF ROWS DISPLAYED IS 1
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
---------+---------+---------+---------+---------+---------
SELECT CURRENT TIME FROM SYSIBM.SYSDUMMY1;
---------+---------+---------+---------+---------+---------

---------+---------+---------+---------+---------+---------
07.12.29
DSNE610I NUMBER OF ROWS DISPLAYED IS 1

ambilileela
Member
Posts: 11
Joined: Tue Jun 06, 2006 2:12 pm

Post by ambilileela » Tue Oct 24, 2006 11:23 am

Hi

To add to it you can get the current timestamp by giving

SELECT CURRENT TIMESTAMP
FROM SYSIBM.SYSDUMMY1


********************************* Top of Data ***************
---------+---------+---------+---------+---------+---------+-
SELECT CURRENT TIMESTAMP
FROM SYSIBM.SYSDUMMY1
---------+---------+---------+---------+---------+---------+-

---------+---------+---------+---------+---------+---------+-
2006-10-24-01.24.48.381162
DSNE610I NUMBER OF ROWS DISPLAYED IS 1
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100


Thanks,
Ambili

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others