Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Display Current Date Post Reply Post New Topic
Author Message
tnwirtu
Newbie
Newbie
Avatar

Joined: 27 Oct 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote tnwirtu Replybullet Topic: Display Current Date
     Posted: 06 Nov 2009 at 8:26am
Hi All,
 
Need some help:
 
let say today: is 10/11/2009
 
My formula:
 
{DATETIME_IN} >= ToText(CurrentTime)
 
 
then my report looks like:
 
 
Tom Naw  15/10/2009 11:11:11   wrong    October is displayed
Tom Naw  10/11/2009 10:20:45   correct
Chris Pow 10/11/2009 10:20:45   correct
Tom Naw  10/11/2009 10:20:45   correct
 
 
{DATETIME_IN} >= ToText(CurrentTime) 
 
Looks like is reading only first two digits 
 
if today is 10/11/2009  for this system means that 15/10/2009 is > than 10/11/2009
 
but why
 
this table is String is not DateTime type I know that so what to do ?
 
I' using XML file as my database
 
If I want to convert for example:
Cdatetime({DATETIME_IN}) = currentdatetime
then receiving bad format string
 
is really weird (if is only current month in xml then is fine, but when xml is growing up next month , ec then system is not able to react properly)
 


Edited by tnwirtu - 06 Nov 2009 at 8:28am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Nov 2009 at 9:43am

the issue is likely the text format you have.

I believe that Crystal assumes it is MM/dd/yyyy fromat not dd/MM/yyyy format.
NOt sure about how it will handle the text>text but if you want to try it make your totext(date) force formating to be the same as your xml string.
It will be seomthing like the below but you may have to chnage as i do not know if you are showing lead zeros in  your day and month fields (1/1/2009 or 01/01/2009)...
{DATETIME_IN} >= totext(currentdatetime,'d/M/yyyy hh:mm:ss')
 
Or if you convert your string to a date you have to swap out the month and date parts.
IP IP Logged
tnwirtu
Newbie
Newbie
Avatar

Joined: 27 Oct 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote tnwirtu Replybullet Posted: 07 Nov 2009 at 1:28am
Hi DBlank,
 
Thank very much for support, you gave me pretty good idea about this, your formula works but only: 'M/dd/yyyy hh:mm:ss'
 
I don't know why system is not able to read dd/M/yyyy hh:mm:ss'
 
if you have string  10/11/2009 10:11:23
 
if you set 'dd/M/yyyy hh:mm:ss'  then should be 10th 11-(Nov)
or
if you set 'M/dd/yyyy hh:mm:ss'  then should be Oct the 11th
 
Any idea? Thanks again!
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Nov 2009 at 7:12am
If you are talking about the Repotr Options Fields defualts I believe this is only for display defualts. I think using cdatetime() or datetim() functions always assumes the field is in M-d-y sequence. I do not know of any way other than formulatic to convert it. It seems to come up a lot on this forum.
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