Hi Group ,
Am new to DB2 . I am facing some problem with date arithmatics :
The current date as today is from the below sql :
db2 "select current date from sysibm.sysdummy1"
1
----------
04/24/2007
1 record(s) selected.
I want to check out the difference between todays date and an old date
'10/15/1999'
db2 "select current date - date('10/15/1999') from sysibm.sysdummy1"
1
----------
70609.
1 record(s) selected.
What does the output 70609 indicates ...Is it no of days ?? Not
possible .
Again I checked with the below query :
pads@ibmrgzng /home/padsdb2 "select date (current date -
date('10/15/1999')) from sysibm.sysdummy1"
1
----------
04/27/0194
1 record(s) selected.
What does the out put indicates ??
Can you please help me .
Best Regards
Bikash Karan 3 4703 ka*********@gmail.com wrote:
Hi Group ,
I want to check out the difference between todays date and an old date
'10/15/1999'
db2 "select current date - date('10/15/1999') from sysibm.sysdummy1"
1
----------
70609.
It's called a date duration. It displays the difference in years,
months and days. So, in your example, it's 7 years, 06 months, 09 days.
On Apr 24, 11:52 am, Ian <ianb...@mobileaudio.comwrote:
karanbik...@gmail.com wrote:
Hi Group ,
I want to check out the difference between todays date and an old date
'10/15/1999'
db2 "select current date - date('10/15/1999') from sysibm.sysdummy1"
1
----------
70609.
It's called a date duration. It displays the difference in years,
months and days. So, in your example, it's 7 years, 06 months, 09 days.
Thanks a lot ....and how about if I modify the query as
$db2 "select date(current date - date('10/15/1999')) from
sysibm.sysdummy1"
1
----------
04/27/0194
1 record(s) selected.
What does this format shows ??
Thanks a lot .
date duration's actual data type is DECIMAL(8,0).
DATE function takes as its argument some different data types and the
result depend on the argument's data type, length and format(if
argument is a character string).
In this example argument is a number(calculated as date duration),
then DATE returns n-1 days after January 1, 0001.
There is another function DAYS which take arguments as date or
timestamp or character representation of them and returns days from
January 1, 0001.
------------------------- Commands Entered -------------------------
VALUES current date - date('10/15/1999');
-------------------------------------------------------------------
1
----------
70609.
1 record(s) selected.
------------------------- Commands Entered -------------------------
VALUES date(current date - date('10/15/1999'));
--------------------------------------------------------------------
1
----------
0194-04-27
1 record(s) selected.
------------------------ Commands Entered -------------------------
VALUES DAYS('04/27/0194');
-------------------------------------------------------------------
1
-----------
70609
1 record(s) selected.
If you want the days between '10/15/1999' and current date, you can
calculate as followings.
------------------------- Commands Entered -------------------------
VALUES DAYS(current date) - DAYS('10/15/1999');
------------------------------------------------------------------------
1
-----------
2748
1 record(s) selected. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: androtech |
last post by:
Hello,
I'm looking for a function that returns a date range for a specified week
number of the year.
I'm not able to find functions like this anywhere. Any pointers/help would
be much...
|
by: Richard Hollenbeck |
last post by:
I'm trying to write some code that will convert any of the most popular
standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan
1908) and compare the first with the second and...
|
by: Tjerk |
last post by:
Hello all,
I have the script below to change an image depending on the date upto
january it worked fine but then it just stopped working does anybody have an
idea how I can make it work again or...
|
by: Thomas R. Hummel |
last post by:
Hello,
I am importing data that lists rates for particular coverages for a
particular period of time. Unfortunately, the data source isn't very
clean. I've come up with some rules that I think...
|
by: Dr John Stockton |
last post by:
It has appeared that ancient sources give a method for Numeric Date
Validation that involves numerous tests to determine month length;
versions are often posted by incomers here. That sort of code...
|
by: captain |
last post by:
Below is the sql for data with same date need
to extract + or - 5 days data of same date also.
How to also get data of + and - days related to same date.
SELECT IM.Area,
IM.Location,...
|
by: Assimalyst |
last post by:
Hi,
I have a working script that converts a dd/mm/yyyy text box date entry
to yyyy/mm/dd and compares it to the current date, giving an error
through an asp.net custom validator, it is as...
|
by: sapnakiran |
last post by:
Can u tell me how can we build up arithmatic operation without using arithmatic operator
|
by: upadhyad |
last post by:
Hi all!!
i am relatively new to c... and I need to help urgently!
i have date and time in 2 separate strings. i have parsed them. eg
I had 26.2.2007 and I parsed it so that i have day month and...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |