Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Add time (minutes) by a formula Post Reply Post New Topic
Author Message
Memoli28
Groupie
Groupie
Avatar

Joined: 10 Apr 2009
Online Status: Offline
Posts: 58
Quote Memoli28 Replybullet Topic: Add time (minutes) by a formula
    Posted: 09 Jan 2010 at 8:48am
Hi All,
 
I know there is a dateadd syntax in crystal ,but is there also a syntax for 'time'add?
 
I have the following field:datetimevalue
 
What kind of syntax do i need to add 20 minutes extra for the time?
 
example:(datetimevalue field)
 
01/01/2010  13:55:00 --> 01/01/2010  14:15:00
 
and what kind of syntax for only a time-field? (without date)
 
 
regards,
Memoli
 
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 11 Jan 2010 at 5:32am

create a formula:

dateadd('n', +20, datetimevalue field)
 
Drop the formula in your report, then right-click the field=>Format Field=>Date and Time (tab) and choose a time only display Style from the list.
 
Hope that works for ya.
IP IP Logged
Memoli28
Groupie
Groupie
Avatar

Joined: 10 Apr 2009
Online Status: Offline
Posts: 58
Quote Memoli28 Replybullet Posted: 12 Jan 2010 at 10:54am
Hi FrnhtGLI ,
 
the formula is working.
 
thank you so much, especially the field formatting for a datetime field.
 
i created many formulas to show some details,like month /date .
 
Never took a look in the field which was a datetimevalue.
 
regards,
Memoli

 
IP IP Logged
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Posted: 28 Nov 2013 at 2:32am
Hi,
 
I have a date and time field and i want to use selection expert and filter records using Current date minus 15 minutes. The date filed on my Table is live and gets updated from the system date on every transaction.  
 
Hem
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 28 Nov 2013 at 2:39am
hi
 
use below formula in your record selection :
 
{databasefield} >=dateadd('m',-15,currentdate) and {databasefield}<=currentdate
 
 
Thanks,
Sastry
IP IP Logged
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Posted: 28 Nov 2013 at 3:23am
Hi,
 
This worked good. Just made a few changes.
 
{DlyTrn.trndte}>= dateadd('n',-15,CurrentDateTime) and
{DlyTrn.trndte}<= CurrentDateTime
 
Thanks for the help.
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.016 seconds.