Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can we get current date from any db2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
rups

New User


Joined: 19 Jan 2006
Posts: 17
Location: bangalore

PostPosted: Mon Jun 04, 2007 10:53 am    Post subject: Can we get current date from any db2 table
Reply with quote

hi,

can we get current date from any db2 table.

thanks
Back to top
View user's profile Send private message

mahi

New User


Joined: 04 Apr 2006
Posts: 86
Location: Pune

PostPosted: Mon Jun 04, 2007 12:07 pm    Post subject:
Reply with quote

yes we cam get it.. As per my knowledge from SYSIBM.SYSDUMMY1 we can get it....
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Mon Jun 04, 2007 4:33 pm    Post subject:
Reply with quote

'SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1 INTO :WS-CURRENT-DATE ' would get you the current date into the working storage variable WS-CURRENT-DATE
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jun 04, 2007 5:14 pm    Post subject:
Reply with quote

prasadvrk wrote:
'SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1 INTO :WS-CURRENT-DATE ' would get you the current date into the working storage variable WS-CURRENT-DATE

Code:
EXEC SQL
SET :WS-CURRENT-DATE = CURRENT DATE
END-EXEC.


Will also work.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jun 04, 2007 8:32 pm    Post subject:
Reply with quote

Hello,

I'm probably missing something here.

Is there some reason to interface with db2 to get a value already locally available from the system?

If you need to adjust the date, using db2 works nicly, but to just obtain the current date? Not sure i understand icon_confused.gif
Back to top
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Wed Aug 08, 2007 3:24 pm    Post subject: How to format dates
Reply with quote

Hi,

I want to foramt date from 'yyyy-mm-dd' to either 'mmyydd' or 'ddmmyy'
or to julian date. CAn someone assist me onthis how to format the date.

Thanks in advance

Harsha.
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Wed Aug 08, 2007 5:55 pm    Post subject:
Reply with quote

Basically current date refers to special register for getting the date....and hence it does not depend on the table.. the reason why we we are using sysdummy is that, it is having only one row always..

if you do select current date from a table having N rows..it will give N records with current date..

As dick said, you can get away with a db call just for current date..
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Aug 08, 2007 6:02 pm    Post subject: Re: How to format dates
Reply with quote

vardhan0007 wrote:
Hi,

I want to foramt date from 'yyyy-mm-dd' to either 'mmyydd' or 'ddmmyy'
or to julian date. CAn someone assist me onthis how to format the date.

Thanks in advance

Harsha.


You ask the same question under another topic.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us