Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: DateTime Stamp Post Reply Post New Topic
Author Message
Liz Williams
Newbie
Newbie
Avatar

Joined: 28 Aug 2009
Location: United States
Online Status: Offline
Posts: 11
Quote Liz Williams Replybullet Topic: DateTime Stamp
     Posted: 21 Jul 2011 at 7:54am

I have a Time Stamp field that I need to split up and use the date for comparison, here’s how the field looks.  Not sure if the field types matter to you but I listed them anyways.

 

Actual                                   

Time In                              

      

Type (P) field                                 

20080417145700          

20080418145000           

 

How it need’s to be for my comparisons.

 

Type (L) field

2008-04-17    1457

2008-04-17    1450

 

I can then compare the Clockin_Date  to the current date using this formula.

 

IF {Clockin_Date} = (CurrentDate-1) THEN 1 ELSE IF {Clockin_Date} = ((CurrentDate-1)+1) THEN 2 ELSE 0

 

To get the Full Time Equivalency hours worked per hour… there a whole lot more to the formula but this will help get me going again.

 
Thanks,
Liz  Dead
 
 
 
Gamblers Go Broke
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Jul 2011 at 3:54am
local stringvar d = {table.field}
local datetimevar aDate;
aDate:= cdatetime(left(d,4), mid(d,5,2), mid(d,7,2),mid(d,9,2), mid(d,11,2))
 
HTH
IP IP Logged
Liz Williams
Newbie
Newbie
Avatar

Joined: 28 Aug 2009
Location: United States
Online Status: Offline
Posts: 11
Quote Liz Williams Replybullet Posted: 22 Jul 2011 at 5:02am
I'm just terrible with date conversions... 
 
I'm giving it a try... but getting the message (A string is required here) for my {CKTIMEFL.TIATIM}  which is the number field I'm working with that contains the date time.
 

20080417145700          

20080418145000           

 

 

Gamblers Go Broke
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Jul 2011 at 10:22am
OH, sorry, didn't realize that it was a number field....
not to worry
change:
local stringvar d = {table.field};
to:
local stringvar d = totext({table.field},0,"");
 
HTH
 
 
IP IP Logged
Liz Williams
Newbie
Newbie
Avatar

Joined: 28 Aug 2009
Location: United States
Online Status: Offline
Posts: 11
Quote Liz Williams Replybullet Posted: 02 Aug 2011 at 6:15am
Sorry, I've been on vacation and just returned.  I'll get my mind back into the game and give it a try...
Thanks
Gamblers Go Broke
IP IP Logged
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