Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

problem on displaying date

Posted on 2006-06-14
18
Medium Priority
?
366 Views
Last Modified: 2008-01-09
why on crystal report the date is displayed ubnormal i.e
when i want to display #1/6/2006# meaning of first of JUNE, the result displayed as 6/1/2006 as JANUARY and sure the result will be different
i tried to play arround the formating but it doesn't work. i use crystal report 9 with visual basic 6.0
 
0
Comment
Question by:howidaelrasheed
  • 7
  • 5
  • 3
  • +2
18 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 16901147
Hi howidaelrasheed,

Crystal Reports should show the date in the correct format if you just add the field to the report.
If you format the field by Right_click and FormatField, then ALL the date formats that are listed show 1st March 1999 (in various formats).  There is no dd-mm-yyyy option listed.
To format in a specific way, choose the one that says 03/01/1999 for example and choose customize. You can then modify any aspect of the date format that you want.

Pete
0
 

Author Comment

by:howidaelrasheed
ID: 16901269
it doesn't work correctly
0
 
LVL 77

Expert Comment

by:peter57r
ID: 16901309
Maybe I'm misreading your Q.

Are you just adding a date field to your report from your database, or are you creating formula field with the specific date value in it?
(If you are entering the date explicitly in a formula then it will assume you mean mm/dd/yyyy.)

Pete
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
LVL 42

Expert Comment

by:frodoman
ID: 16902159
Check the regional settings on your PC.  Depending on these settings Crystal (and most other applications) will interpret 1/6 as either June 1st or January 6th.

0
 
LVL 1

Expert Comment

by:wsinv
ID: 16904031
You can set the date properties within Crystal reports.

Open Crystal Reports

Select File>Options

Select the Fields Tab > Click on the Date Button

Select the Date Tab

Select the date format you wish to change. (i.e. system default short format)

once selected, click on customize.

There is a section called Order:  Choose YMD , DMY or MDY as your default...

Good Luck,

wsinv

 
0
 

Author Comment

by:howidaelrasheed
ID: 16909574
thanx for reply
I don't know where is the problem resides. here what i follow
I create two textbox to indicate Fromdate and ToDate in visual basic 6.0
I wrote in Fromdate textbox 1/6/2006
ToDate textbox 30/6/2006
and press the button which contains theo following code:
------------------------
If Not IsDate(txtFromDate) Or Not IsDate(txtToDate) Then
        MsgBox " incorrect Date"
        Exit Sub
    End If
     myselect1 = Trim("#" & txtFromDate.Text & "#")
       myselect2 = Trim("#" & txtToDate.Text & "#")
       myreport = "\rpt_actualDelivery" + ".rpt"
     
        rpt_actualDelivery.Show

--------------------------------
on the  rpt_actualDelivery form which contains the crystalreport viewer i wrote the following:
------------------
Private appp As CRAXDRT.Application
Private rpt As CRAXDRT.Report
Private Sub Form_Load()
    On Error Resume Next
 
    Set appp = New CRAXDRT.Application
    Set rpt = New CRAXDRT.Report
    Set rpt = appp.OpenReport("" & App.Path & "\ReportS" & myreport, 0)
    rpt.BottomMargin = 0
    rpt.LeftMargin = 0
    rpt.RightMargin = 0
    rpt.TopMargin = 0
           
            If Not myselect1 = "" Then
                rpt.FormulaFields(1).Text = myselect1
            End If
            If Not myselect2 = "" Then
                rpt.FormulaFields(2).Text = myselect2
            End If
    CRViewer91.ReportSource = rpt
    CRViewer91.ViewReport
   
    myselect1 = ""
    myselect2 = ""
End Sub

------------------
 when i run the application the report date appears as January Not JUNE when i change the date on FromDate textbox to 14/6/2006 the report appears as JUNE.
so what is the wrong on my code??
Regards.
0
 
LVL 1

Expert Comment

by:wsinv
ID: 16910925
I do not believe there is anything wrong with your code. I think your setings in crystal reports needs to be changed.

Have you tried the suggestion from my last post?

wsinv
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16925318
I agree.  Either you r setting in Crystal is incorrect or your regional setting is incorrect.

I find dates diffivult to deal with especially when entering them as a string.  Have you tried using a DatePicker or Calendar control to enter the dates?

mlmcc
0
 

Author Comment

by:howidaelrasheed
ID: 16928773
i tired all your solutions but no response the problem is still there
is it a problem on crystal report (i use version 9)
here what i configure the crystal report:
on Edit Formula for @FromDate i wrote #1/6/2006#
on Format Field is Date DMY
on Edit Fromula for @ToDate :#30/08/2006#
same thing on Format Field
when I run it it display the @Fromdate formula as 6/1/2006 as Jaunary
i really do not know what is the problem i do everything that i could do change the setting on control panel and play around the date configuration on crystal report but nothing works. the problem also when i try to write @FromDate for example as #14/6/2006# it displayed as June why this changes happens is it a problem on crsytal report itself or WHAT???
pls help because i have many reports depends on this idea.. what can i do if this not works?? it is critical to me.
Reards....
0
 

Author Comment

by:howidaelrasheed
ID: 16929237
any Help plssss
0
 
LVL 77

Accepted Solution

by:
peter57r earned 375 total points
ID: 16929481
Like I said many posts back, if you enter a date between #..# it will be assumed that it is in mm/dd/yy format.  Only if that does not produce a valid date will other formats be tried.

Therefore you must enter it in mm/dd/yy format or use yyyy-mm-dd which will not be misinterpreted.

Pete
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16929500
>>#14/6/2006# it displayed as June why
It is displayed as June because there is no 14th month.

mlmcc
0
 

Author Comment

by:howidaelrasheed
ID: 16929629
thanx Pete
so what is the suitable way to write it instead of using #..#
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 375 total points
ID: 16929816
Try something like this

rpt.FormulaFields(1).Text = Date(right(myselect1,4),mid(myselect1,3,2),left(myselect1,2))

mlmcc
0
 

Author Comment

by:howidaelrasheed
ID: 16978134
i have one more question: if i want to display monthname it will display it as configured from control panel. is there anyway to customize it from either crystalreport or from visual basic to aspecific monthname like i want to customize it to dsiplay it in arabic format for exmple.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16981077
Sure.  Create a formula like

numbervar intMonth;
intMonth := mid(myselect1,3,2);
if intMonth = 1 then
  "January"
else if intMonth = 2 then
  "February"
...
else if intMonth = 12 then
  "December"

Obviously change the month names to what you want.

mlmcc

0
 

Author Comment

by:howidaelrasheed
ID: 16991329
thank you very much dear mlmcc you deserve more than THANK You
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16998343
Glad i could help

Thanks for the kind words.

mlmcc
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question