Crystal Date Functions

Hello I have the below formula;
cstr(Date (CurrentDateTime-30)) +' To '+ cstr(date((CurrentDateTime-22)))

Open in new window

This is displaying 8/12/2013 To 8/20/2013
How can I change the formula to show 8/12/13 to 8/20/13
Can it be done?
Star79Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

plusone3055Commented:
cstr(DateAdd ("d", -30, CurrentDate) +' To '+ cstr(DateAdd ("d", -22, CurrentDate)
0
plusone3055Commented:
sorry  missing brackets
this will work :)

cstr(DateAdd ("d", -30, CurrentDatetime)) +' To '+ cstr(DateAdd ("d", -22, CurrentDatetime))
0
Star79Author Commented:
Your formula is giving 8/12/2013  12:00:00AM To 8/20/2013  12:00:00AM

I only want to see date field as 8/12/13.
2013 is cut short to just 13.Can it be done?
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

plusone3055Commented:
in that case you need to make two fields and combine them
so make a textobject
and two formula fields

formula 1
cstr(cdate(DateAdd ("d", -30, currentdate)))

formula 2
cstr(cdate(DateAdd ("d", -22, currentdate)))

them make a textobject

@formula 1  to  @formula2

works perfectly :)
0
plusone3055Commented:
in that case you need to make two fields and combine them
so make a textobject
and two formula fields

formula 1
cstr(cdate(DateAdd ("d", -30, currentdate)))

formula 2
cstr(cdate(DateAdd ("d", -22, currentdate)))

them make a textobject

@formula 1  to  @formula2

works perfectly :)
0
Star79Author Commented:
actually this what is working

ToText((today-22),"MM/dd/yy") +' - '+ ToText((today-30),"MM/dd/yy")
0
mlmccCommented:
Actual answer is to reverse your fields to get it into the correct order.

mlmcc
0
Star79Author Commented:
Mlmcc,
sorry I coudlnt get it, my formula
ToText((today-1),"MM/dd/yy") +' - '+ ToText((today-7),"MM/dd/yy")
displays
09/10/13 - 09/04/13
0
mlmccCommented:
You have the from and to reversed

ToText((today-7),"MM/dd/yy") & '-' & ToText((today-1),"MM/dd/yy")

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
plusone3055Commented:
Star
I think that was really wrong I had the working formula before mlmcc(no offense to him he is a great poster)

In the future please award points accordingly
0
mlmccCommented:
He had the answer, just had the dates in the wrong order.  I just pointed that out and he couldn't figure out how to reverse them.

Your formula didn't set the formats as desired.  That was the original question how to show only a 2 digit year.

mlmcc
0
plusone3055Commented:
mlmcc
My mistake
I was writing these answers in transit
I thought it had the correct date format
I retract my previous statement :)
0
mlmccCommented:
No problem.  If you had your default set in global preferences to be a 2 digit year what you tried might have produced the desired result.

If your idea had worked, he would have accepted it before I posted that his solution had the wrong order.

mlmcc
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.