Perhaps you're having a time zone problem where it's the 9th on the
client and the 8th on the server.
 
A Date instance has a time as well as a date. I'd recommend breaking the
Date into month/day/year on the client and sending only that information
to the server.
 
- Gordon

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of baserath_2001
Sent: Friday, February 09, 2007 1:18 PM
To: [email protected]
Subject: [flexcoders] Datefield inconsistencies? Or is it just me!



This little error is driving me crazy:

I am trying to populate a datagrid with values from a table based on 
the day selected in the datefield. I can use the datefield to choose 
and pass the value to my webservice but the result returned does not 
reflect the date selected. For example I can select 2/9/2007 and the 
service sends 2/8/2007 if it sends any data at all.

Is my error in flex or in my webservice. I know this is not a 
coldfusion forum but I use a cffunction as my service. I feel it may 
be flex related since occasionally I can get the same error in 
VB.net. 

When the component is created I set the default date of the datefield 
using the following code in the DateField Creation Complete event:

creationComplete="dtcLogDate.selectedDate = new Date();" 

The initialized the data loads properly based on the above setting 
but when I start changing the date is where the problem exists.

I pass the variable as the input parameter in the service using:

<mx:request>
<dateVar>{dtcLogDate.selectedDate}</dateVar>
</mx:request>

My webservice is below as you can see I receive the dateVar as a 
cfarugment I then break it down into dayparts in order to filter my 
data since the data, which being filtered is stored in "mm/dd/yyyy 
hh:mm:ss AM" format in the db.

<cffunction 
name="getLogHistory" 
displayname="getLogHistory" 
hint="I get the log history for display" 
access="remote" 
output="false" 
returntype="query">

<cfargument name="dateVar" required="false" />

<cfset scheduleMonth = #DateFormat(arguments.dateVar, "mm")#>
<cfset scheduleDay = #DateFormat(arguments.dateVar, "dd")#>
<cfset scheduleYear = #DateFormat(arguments.dateVar, "yyyy")#>


<cfquery name="gryLogHistory" datasource="test">
SELECT
E.first_name,
E.last_name,
E.address,
E.city,
E.state,
E.zip,
E.email,
E.phone as empPhone,
STUFF(CONVERT(char(19), L.logrecord , 100),1,12,'') AS 
LogInTime,
L.eid,
S.store_code,
S.address as StoreAddress,
S.city as StoreCity,
S.state as StoreState,
S.phone as StorePhone
FROM dbo.loghistory AS L
INNER JOIN dbo.employees AS E
ON L.eid = E.eid
INNER JOIN dbo.stores AS S
ON S.sid = E.sid
WHERE DATEPART(yyyy, L.logrecord) = #scheduleYear# AND 
DATEPART(mm, L.logrecord) = #scheduleMonth# AND
DATEPART(dd, L.logrecord) = #scheduleDay# 
order by logrecord desc
</cfquery>
<cfreturn gryLogHistory />
</cffunction>

Thanks in advance!
Shawn



 

Reply via email to