I think you were on the right track with .getTime()

I tried your SYSDATE example and was able to get the desired result with;

lsparsedatetime(qry.sysdate).getTime()

I also tried casting the date in the SQL, but the above works (for SYSDATE at 
least)

On 16/02/2012, at 13:02, Andrew Myers <am2...@gmail.com> wrote:

> I think I'll just do what i was initially trying to do and write a function 
> that creates a Java date and be done with it.
> 
> In fact if I'd have stopped whining and just written the damn thing id be on 
> to the next problem by now :)
> 
> 
> On 16/02/2012, at 12:43 PM, "Steve Onnis" <st...@cfcentral.com.au> wrote:
> 
>> CreateDate() ?
>> 
>> -----Original Message-----
>> From: Andrew [mailto:am2...@gmail.com] 
>> Sent: Thursday, 16 February 2012 12:40 PM
>> To: cfaussie
>> Subject: [cfaussie] Re: Convert cf date to milliseconds since the epoch?
>> 
>> Hmm not that simple.  The dates are coming from a query, and .getTime()
>> appears not to be valid, for example:
>> 
>> <cfquery name="q" datasource="ds_web_content">
>>   select sysdate from dual
>> </cfquery>
>> 
>> <cfdump var="#q.sysdate#">
>> 
>> <cfoutput>#q.sysdate.getTime()#</cfoutput>
>> 
>> Error:
>> 
>> The getTime method was not found.
>> Either there are no methods with the specified method name and argument
>> types or the getTime method is overloaded with argument types that
>> ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match
>> the provided arguments. If this is a Java object and you verified that the
>> method exists, use the javacast function to reduce ambiguity.
>> 
>> This doesn't work either:
>> 
>> <cfset javaDate = JavaCast("java.util.Date", q.sysdate)>
>> 
>> Error: JavaCast type java.util.Date must be one of the following
>> types: byte, char, short, int, long, float, double, boolean, string,
>> bigdecimal, their corresponding array representation (eg : int[]), or null.
>> 
>> Mongrel!
>> 
>> On Feb 16, 12:28 pm, Andrew <am2...@gmail.com> wrote:
>>> Umm, okay this works:
>>> 
>>> <cfset dateNow = now()>
>>> 
>>> <cfoutput>#now.getTime()#</cfoutput>
>>> 
>>> Always missing the obvious!
>>> 
>>> On Feb 16, 12:24 pm, Andrew <am2...@gmail.com> wrote:
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> This is sort of related to my graphing question from the other day.
>>> 
>>>> I'm using Flot and the times need to be expressed as milliseconds 
>>>> since January 1,
>>>> 1970 00:00:00.
>>> 
>>>> In Java you can call .getTime() on a function to do this.  Does CF 
>>>> provide a simple way to either:
>>> 
>>>> * Convert a cf date to time in millis?; OR
>>>> * Convert a cf date to a java date?
>>> 
>>>> I could create a new Java Calendar object and then set the various 
>>>> date parts, but before I write a wrapper function to do it that way 
>>>> I figured I'd see if I was missing something obvious?
>>> 
>>>> Andrew.
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "cfaussie" group.
>> To post to this group, send email to cfaussie@googlegroups.com.
>> To unsubscribe from this group, send email to
>> cfaussie+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/cfaussie?hl=en.
>> 
>> 
>> 
>> 
>> 
>> 
>> =======
>> Email scanned by PC Tools - No viruses or spyware found.
>> (Email Guard: 9.0.0.909, Virus/Spyware Database: 6.19260)
>> http://www.pctools.com/
>> =======
>> 
>> 
>> 
>> 
>> 
>> =======
>> Email scanned by PC Tools - No viruses or spyware found.
>> (Email Guard: 9.0.0.909, Virus/Spyware Database: 6.19260)
>> http://www.pctools.com/
>> =======
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "cfaussie" group.
>> To post to this group, send email to cfaussie@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> cfaussie+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/cfaussie?hl=en.
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "cfaussie" group.
> To post to this group, send email to cfaussie@googlegroups.com.
> To unsubscribe from this group, send email to 
> cfaussie+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/cfaussie?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to