Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: timediff Post Reply Post New Topic
Author Message
jay52
Newbie
Newbie


Joined: 17 Jul 2009
Online Status: Offline
Posts: 9
Quote jay52 Replybullet Topic: timediff
    Posted: 08 Feb 2011 at 8:14am
i have two fields that are varchar in the db that hold the time - in format hh:mm a or p
 
i am trying to calculate the difference between them with something like
 
datediff("n",CTime({Command.timeout}),Time({Command.timein}));
 
but i keep getting getting an error on the first portion.
 
I can convert using CTime and it prints out the correct time like so... but can't figure out how to use these variables in a calulation
 
local Timevar Out :=CTime({Command.timeout});
local TimeVar tin :=CTime({Command.timein});
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Feb 2011 at 8:33am
I believe that datediff it looking for a date or datetime not just a time.
Add a 'fake date' to your times and try it...also likely you want to change your time in as first and time out as seciond...
datediff("n",date(2009,1,1) + ctime({Command.timein}),date(2009,1,1) + ctime({Command.timeout}))
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.