lol ignore the typos in that exception..
cut & paste strikes back
-----Original Message-----
From: Craig Dudley
Sent: 07 July 2003 15:14
To: CF-Talk
Subject: RE: java class - how to (was RE: Date Time (GMT 1970))
Here's the CFX version..
-----------------------------
import com.allaire.cfx.*;
import java.text.SimpleDateFormat;
import java.util.*;
public class formatDate implements CustomTag{
public void processRequest( Request request, Response response )
throws Exception
{
if ( !request.attributeExists("dateinsecs") )
{
throw new Exception("Missing attribute 'dateinsecs', a
value in secons from epoch is required attributes for this tag)");
}
String seconds = request.getAttribute("dateinsecs");
long secs = Integer.parseInt(seconds);
long millseconds = secs * 1000;
Date dateObj = new Date(millseconds);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd
HH:mm:ss");
String formattedDate = sdf.format(dateObj);
response.setVariable( "formattedDate", formattedDate);
}
}
-----------------------------
<cfx_formatdate dateinsecs="1057580739">
<cfoutput>#formattedDate#</cfoutput>
-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: 07 July 2003 15:02
To: CF-Talk
Subject: RE: java class - how to (was RE: Date Time (GMT 1970))
man, if you could, that would be CFX MAGNIFICENCE!!!
I could then have a workaround for the problem that dateAdd() in CFMX is
causing me....
and im sure some others who use dateAdd() could certainly use it!!
later
tony weeg
uncertified advanced cold fusion developer
tony at navtrak dot net
www.navtrak.net
office 410.548.2337
fax 410.860.2337
-----Original Message-----
From: Craig Dudley [mailto:[EMAIL PROTECTED]
Sent: Monday, July 07, 2003 9:54 AM
To: CF-Talk
Subject: RE: java class - how to (was RE: Date Time (GMT 1970))
Not sure, I just threw that together in 2 mins,
>From the command line, its just..
Java formatDate 1057580739
Cfobject should be able to do it, I'll have quick play.
I can re-write it as a CFX in about another 2 mins tho if you'd prefer.
-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: 07 July 2003 14:54
To: CF-Talk
Subject: java class - how to (was RE: Date Time (GMT 1970))
hey craig, how would one use that class in cfmx?
thanks.
tony weeg
uncertified advanced cold fusion developer
tony at navtrak dot net
www.navtrak.net
office 410.548.2337
fax 410.860.2337
-----Original Message-----
From: Craig Dudley [mailto:[EMAIL PROTECTED]
Sent: Monday, July 07, 2003 9:48 AM
To: CF-Talk
Subject: RE: Date Time (GMT 1970)
Here, this java class works,
Pass it your seconds values and it spits back a formatted date.
import java.text.SimpleDateFormat;
import java.util.*;
public class formatDate{
public static void main(String args[]) {
String seconds = args[0];
long secs = Integer.parseInt(seconds);
long millseconds = secs * 1000;
Date dateObj = new Date(millseconds);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd
HH:mm:ss");
String formattedDate = sdf.format(dateObj);
System.out.println(formattedDate);
}
}
-----Original Message-----
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 07 July 2003 14:18
To: CF-Talk
Subject: RE: Date Time (GMT 1970)
I've been told that DateAdd() sucks on MX if the date is within DST??
-----Original Message-----
From: Craig Dudley [mailto:[EMAIL PROTECTED]
Sent: 07 July 2003 14:04
To: CF-Talk
Subject: RE: Date Time (GMT 1970)
#dateformat(dateadd("s",1057580739,"1/1/1970"),"yyyy/mmm/dd")#
= 2003/Jul/07
-----Original Message-----
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 07 July 2003 13:58
To: CF-Talk
Subject: RE: Date Time (GMT 1970)
That's an example
1057580739
I think it should be converted to 7th July 2003, 13:25 or something like
that.
-----Original Message-----
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED]
Sent: 07 July 2003 13:17
To: CF-Talk
Subject: RE: Date Time (GMT 1970)
is it logging in julian format? or actually in seconds? can you provide
an example of what a log looks like...
-----Original Message-----
From: Tom Smith [mailto:[EMAIL PROTECTED]
Sent: 07 July 2003 13:14
To: CF-Talk
Subject: Re: Date Time (GMT 1970)
are you getting the date in seconds, if so, use dateFormat() and it
should work fine:)
----- Original Message -----
From: "Shahzad.Butt" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, July 07, 2003 1:09 PM
Subject: RE: Date Time (GMT 1970)
> We have got a software running to LOG telephone calls and that
> software has got its own DB and date/time it is logging call is in
> seconds starting from Midnight (00:00:00) January 1, 1970. Now I want
> to run report with some understandable date/time format - so I need a
> conversion mechanism.
>
> -----Original Message-----
> From: Craig Dudley [mailto:[EMAIL PROTECTED]
> Sent: 07 July 2003 12:55
> To: CF-Talk
> Subject: RE: Date Time (GMT 1970)
>
>
> tbh I don't quite understand what you are trying to do.
>
> Are you trying to convert a java/javascript milliseconds from epoch
> value to GMT?
>
> -----Original Message-----
> From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
> Sent: 07 July 2003 12:51
> To: CF-Talk
> Subject: Date Time (GMT 1970)
>
>
> Any custom tag / UDF which can convert date/time value with GMT
> (Starting from Midnight January 1970) and it should go backward as
> well converting GMT (1970) to normal date/time?
>
> Thanks
> Shaz
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4