Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining dates

Status
Not open for further replies.

rcaesar

MIS
Sep 5, 2002
92
US
Hi
I would like to combine two date fields in a impromptu report(Begin and End dates) in one column.

They should look something like this:

04-01-04 - 07-04-05

What I have done is :

DatetoString(BeginDate) + ' - ' + DatetoString(EndDAte)

and I get:

2004-04-01 - 2005-07-01
How can I get this in mmddyy format.

Thanks



 
I think that there's not a simple way to do that, you'll have to split the original date field into pieces (making use of year, month, day function) and then build a new string field and things like that...

regards

Einyel
Functional&Technical Cognos Consultant
 
Thanks Einyel

Thats a thought. Will try that.
 
number-to-string(Month(Date1))+'-'+number-to-string(Day(Date1))+'-'+substring(number-to-string(Year(Date1)),3,2)+' - '+number-to-string(Month(Date2))+'-'+number-to-string(Day(Date2))+'-'+substring(number-to-string(Year(Date2)),3,2)

If you want it to always show two digit for Month and Day, you will need to use the number-to-string-padded function.

Pain is stress leaving the body

DoubleD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top