PDA

View Full Version : Date Format


nmabey414064
10-25-2010, 06:37 AM
Hi,

is it possible to use the chart in another date format than mm/dd/yyyy?

We are UK based and it would be ideal to send start end end date in dd/mm/yyyy.

Thanks for the help

Jason Byrnes
10-26-2010, 08:04 AM
you would need to edit the query created for the chart and use the MySQL Date_FORMAT command.


in the DynamicWebCharts/Data folder a file will be created named <pageName>_data1.php where <pageName> is the name of the page you applied the chart to.

this file has the recordset.


edit the recordset and add the DATE_FORMAT function around the date column:
DATE_FORMAT(dateColumn, '%d/%m/%Y')

nmabey414064
10-26-2010, 08:13 AM
I am using ASP in VBscript and in the <pageName>_data1.asp is no date format function.

Where can I find this function in asp/vb?

Thanks very much for quick reply

Jason Byrnes
10-26-2010, 08:20 AM
in Access, it would be:
Format(dateColumn, 'dd/mm/YYYY')

nmabey414064
10-26-2010, 08:35 AM
Sorry that might sound stupid...

But in which document can I change this?

My MsAccess database is using dd/mm/yyyy. The Graph doesn't display when I am sending dates in dd/mm/yyyy they need to be mm/dd/yyyy.
My
name_data1.asp,
name_dataparser1.asp,
wa_dfc_xmlVB.asp
nor wa_dwc.dtd
has a format date section.

So where do I change the format?

Thanks very much for all the help, I am new to this all and somethimes you can't the wood for the trees.

Thanks for all the help

Jason Byrnes
10-26-2010, 09:20 AM
The Graph doesn't display when I am sending dates in dd/mm/yyyy



ok this is the missing piece, how are you sending them in? through form? a query string?


can you sends a copy of the page that displays the graph and a copy of the data page, this may help me give you a better answer.

nmabey414064
10-29-2010, 01:33 AM
I think it is through a query string...


I Query FD (FirstDay) and LD (LastDays) on the previous page like this (I set <%session.lcid=1033%> on the top of the page, so that the date is created in the american way, otherwise the graph is not displayed):

dim LD
dim FD
dim todaydate
todaydate = Day(date)
if RSD > todaydate then
FD = DateSerial(Year(Date), Month(Date) -2, RSD)
LD = DateSerial(Year(Date), Month(Date) -1, RSD -1)
else
FD = DateSerial(Year(Date), Month(Date) -1, RSD)
LD = DateSerial(Year(Date), Month(Date) -0, RSD -1)
end if

and then I pass them through a link and the url to the next page that displays the graph.
The url look then like this:
.../protected2.asp?Site_ID=5&Site_Name=Site%202&AM=4361&FD=9/15/2010&LD=10/14/2010

The code for the graph on the page displaying it is:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="940" height="200">
<param name="movie" value="DynamicWebCharts/open-flash-chart.swf?data=DynamicWebCharts/Data/protected2_dataparser1.asp?Site_ID=<%=Request.QueryString("Site_ID")%>%26FD=<%=Request.QueryString("FD")%>%26LD=<%=Request.QueryString("LD")%>" />
<param name="quality" value="high" />
<embed src="DynamicWebCharts/open-flash-chart.swf?data=DynamicWebCharts/Data/protected2_dataparser1.asp?Site_ID=<%=Request.QueryString("Site_ID")%>%26FD=<%=Request.QueryString("FD")%>%26LD=<%=Request.QueryString("LD")%>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="940" height="200"></embed>
</object>

The code of the data page looks like this:

<%
Dim MM_Stats14_STRING
MM_Stats14_STRING = "dsn=Login;"
%>
<%
Dim WADWCStats__ParamSite_ID
WADWCStats__ParamSite_ID = "-1"
If (Request.QueryString("Site_ID") <> "") Then
WADWCStats__ParamSite_ID = Request.QueryString("Site_ID")
End If

Dim WADWCStats__ParamFistDay
WADWCStats__ParamFistDay = "-1"
If (Request.QueryString("FD") <> "") Then
WADWCStats__ParamFistDay = Request.QueryString("FD")
End If

Dim WADWCStats__ParamLastDay
WADWCStats__ParamLastDay = "-1"
If (Request.QueryString("LD") <> "") Then
WADWCStats__ParamLastDay = Request.QueryString("LD")
End If

Dim WADWCStats
Dim WADWCStats_cmd
Dim WADWCStats_numRows

Set WADWCStats_cmd = Server.CreateObject ("ADODB.Command")
WADWCStats_cmd.ActiveConnection = MM_Stats14_STRING
WADWCStats_cmd.CommandText = "SELECT Stats_Date AS XLABEL, Minutes AS YVALUE FROM Stats WHERE Site_ID = " & Request.QueryString("Site_ID") & " AND Stats_Date >= #" & Request.QueryString("FD") & "# AND Stats_Date <= #" & Request.QueryString("LD") & "# ORDER BY Stats_Date"
WADWCStats_cmd.Prepared = true

Set WADWCStats = WADWCStats_cmd.Execute
WADWCStats_numRows = 0
%>


Does that make sense, does this helps?

If I don't create the date in the american way and sent it in the uk way the graph doesn't display so I think I have to change somehow the way the graph wants to receive the date, but where?


Thanks very much for the help

Jason Byrnes
10-29-2010, 06:50 AM
add this code to the page that has the chart on it:


<%
function switchMonthDay(theDate)
dim theMonth,theDay,theYear
theMonth = Left(theDate,inStr(theDate,"/")-1)
theYear = Right(theDate, Len(theDate) - inStrRev(theDate,"/"))
theDay = Mid(theDate,inStr(theDate,"/")+1, inStrRev(theDate,"/")-inStr(theDate,"/")-1)
switchMonthDay = theDay & " / " & theMonth & " / " & theYear
end Function
%>



then locate these two code blocks:
<%=Request.QueryString(" FD")%>
<%=Request.QueryString("LD")%>

and change them to:
<%=switchMonthDay(Request.QueryString(" FD"))%>
<%=switchMonthDay(Request.QueryString("LD"))%>

nmabey414064
10-29-2010, 07:54 AM
Thanks very much it works!

Jason Byrnes
10-29-2010, 07:57 AM
you're welcome.