Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Subtract Integer from DateTime Post Reply Post New Topic
Author Message
Alldaypilot
Newbie
Newbie


Joined: 18 Sep 2008
Online Status: Offline
Posts: 3
Quote Alldaypilot Replybullet Topic: Subtract Integer from DateTime
    Posted: 18 Sep 2008 at 7:16pm
 
I have one database field that stores a datetime.  I have another one that stores an integer value (represents minutes).
 
How can I write a formula that takes the datetime, subtracts the integer(minutes), and gives me the new datetime?
IP IP Logged
Savan
Senior Member
Senior Member
Avatar

Joined: 14 Dec 2007
Location: India
Online Status: Offline
Posts: 162
Quote Savan Replybullet Posted: 18 Sep 2008 at 11:17pm
you can use this function
 
Dateadd("n",(<integer>*-1),{@tday})
 
where n stands for minutes to be added or subtract
 
(<integer>*-1)  is the no of minutes (table field name)  to be subtracted
 
{@tday} is the date from which the minutes to be subtracted.
 
You can find many more such inbult  functions of crystal reports in chapter 6 "Programming with Crystal Syntax" of  Brians Bischof book " Crystal Reports Encyclopedia"
Thanks
Savan
IP IP Logged
Alldaypilot
Newbie
Newbie


Joined: 18 Sep 2008
Online Status: Offline
Posts: 3
Quote Alldaypilot Replybullet Posted: 19 Sep 2008 at 9:18am
Thanks!  That worked.
 
I was actually playing with Dateadd yesterday but couldn't get it working right.
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.035 seconds.