Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with a Date Formula Post Reply Post New Topic
Author Message
WCrew04
Newbie
Newbie


Joined: 30 May 2007
Location: United States
Online Status: Offline
Posts: 1
Quote WCrew04 Replybullet Topic: Help with a Date Formula
    Posted: 30 May 2007 at 12:00pm
I have been trying to make a formula that will take a date field and display the last date of the month but can't get it to work and am getting very frustrated.
 
For example, if the date field is 05/25/2007 I want the formula to display 5/31/2007.
 
Any help would be greatly appreciated. Thanks!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 30 May 2007 at 2:17pm
I think there is a better formula than this one, but it escapes me rght now. Sorry.
//Get the first day of the next month
x := DateAdd("m",1,Date(Year(field),Month(field),1));
//Subract one day from it.
x := DateAdd("d", -1, x);

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.