Re: mySQL, datetime, and ColdFusion date objects

2010-05-18 Thread Scott Brady

That makes sense. It also explains why it was warning me of data truncation.

Scott

On Tue, May 18, 2010 at 10:35 AM, Leigh  wrote:

>
> > Well, I guess that's the problem. I was certain there was a
> > cf_sql_datetime
> > (and pretty certain I've been using it for years :)
> > ).  I guess I'd expect
> > CF to throw an error for an invalid sql type.
>
>
> Yes, that was my expectation too. But I _think_ CF does not not validate
> the types. IIRC, it just uses the default type CHAR when an invalid
> cfsqltype is passed.
>
> -Leigh
>
>
>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333807
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-18 Thread Leigh

> Well, I guess that's the problem. I was certain there was a
> cf_sql_datetime
> (and pretty certain I've been using it for years :)
> ).  I guess I'd expect
> CF to throw an error for an invalid sql type.


Yes, that was my expectation too. But I _think_ CF does not not validate the 
types. IIRC, it just uses the default type CHAR when an invalid cfsqltype is 
passed.

-Leigh


  

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333785
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-18 Thread Scott Brady

Well, I guess that's the problem. I was certain there was a cf_sql_datetime
(and pretty certain I've been using it for years :) ).  I guess I'd expect
CF to throw an error for an invalid sql type.

Thanks!

Scott


On Mon, May 17, 2010 at 7:46 PM, Leigh  wrote:

>
> > Well, a "timestamp" in mySQL is a bit different from a
> > "datetime", so it seems a little weird using that sql type
> > in the param
>
> Oh .. that.  The thing to remember is cfsqltypes are based on the generic
> java.sql.Types used in JDBC (for all databases). Not the names of the data
> types used by your database. Obviously the two are connected, and most of
> the names do correspond pretty closely. But there are a few exceptions.
> "Timestamp" is one of them.
>
> http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Types.html
>
> For whatever reason they chose not to have a type called DATETIME type, and
> instead used the name TIMESTAMP. I am not sure why they chose to break with
> convention there .. but they did. So "Timestamp" is the correct type to use
> for date/time columns.
>
> (If you want some real fun, try and figure out the correct types to use for
> the approximate numeric types ... ;)
>
>
>
>
>
>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333771
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-17 Thread Leigh

> Well, a "timestamp" in mySQL is a bit different from a
> "datetime", so it seems a little weird using that sql type 
> in the param

Oh .. that.  The thing to remember is cfsqltypes are based on the generic 
java.sql.Types used in JDBC (for all databases). Not the names of the data 
types used by your database. Obviously the two are connected, and most of the 
names do correspond pretty closely. But there are a few exceptions. "Timestamp" 
is one of them. 

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Types.html

For whatever reason they chose not to have a type called DATETIME type, and 
instead used the name TIMESTAMP. I am not sure why they chose to break with 
convention there .. but they did. So "Timestamp" is the correct type to use for 
date/time columns.

(If you want some real fun, try and figure out the correct types to use for the 
approximate numeric types ... ;)




  


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333770
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-17 Thread Scott Brady

On Mon, May 17, 2010 at 1:58 PM, Leigh  wrote:

>
> > > I'd still like to know if there's a better way
>
> > I am not sure I understand the question.  Using cf_sql_timestamp for a
> date/time column is perfectly valid. So better than what ..? ;)
>

Well, a "timestamp" in mySQL is a bit different from a "datetime", so it
seems a little weird using that sql type in the param (plus, I used a code
generator to generate by CFCs, which uses the field's datatype to determine
what sql type to use -- I guess I can change that code to conditionally use
timestamp for date times).

I guess the real question is if I was doing something wrong for date time to
not be working for some reason.

(It turns out that the "global" search and replace in CF Eclipse on the Mac
isn't working very well for me. At least regards to switching out
cf_sql_datetime with cf_sql_timestamp -- I keep coming across instances it's
missing.)

Scott

-- 
-
Scott Brady
http://www.scottbrady.net/


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333769
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-17 Thread Leigh

> CreateODBCDateTime()
> CreateODBCDate()
> ..

I used to use those as well. But now prefer cfqueryparam since provides some 
additional benefits over CreateODBC...(), like the usage of bind variables.



  


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333768
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-17 Thread Shaun Webster

I always use the following function when inserting dates/times into sql.

CreateODBCDateTime()
CreateODBCDate()
CreateODBCTime()

--
Shaun Webster
480 Broadway  Suite 328, Saratoga Springs NY 12866
office: 518.632.4333  |  mobile: 518.269.2132  |  fax: 518.490.1236
sh...@webvalve.com  |  www.webvalve.com

--
This email, and any files transmitted with it, is confidential and intended 
solely for the use of the individual or entity to whom it is addressed.
--

On May 17, 2010, at 1:56 PM, Scott Brady wrote:

> 
> Well, it looks like I can leave the field as a datetime but just use
> cf_sql_timetamp in the queryparams.
> 
> I'd still like to know if there's a better way, but it's a lot easier to
> search and replace that than to change every field in the database.
> 
> Scott
> 
> On Mon, May 17, 2010 at 11:48 AM, Scott Brady  wrote:
> 
>> I'm running into an issue I'm hoping others have seen.
>> 
>> We have a number of fields that need to be date times, and I'm getting this
>> type of error when trying to enter them into the database:
>> Data truncation: Incorrect datetime value: '{ts '2010-05-17 11:40:23'}' for
>> column 'modified' at row 1
>> 
>> If I change them to a time stamp (and set the sql type in the param to
>> cf_sql_timestamp) it works -- though, I'm not looking forward to changing
>> every single table that has these fields in them.  If I just leave the field
>> alone and change it to cf_sql_date, it works (though, as expected, doesn't
>> put the time part of the date time in there).
>> 
>> Is there some weirdness with ColdFusion date time objects and mySQL
>> datetime fields? (this is ColdFusion 9 and mySQL 5)
>> 
>> I could go through and change all of the fields to timestamps (except for
>> things like birthdate, but that can be just "date", since I believe
>> timestamp won't work for dates before 1970), but was hoping for an easier
>> option.
>> 
>> Thanks!
>> 
>> Scott
>> 
>> --
>> -
>> Scott Brady
>> http://www.scottbrady.net/
>> 
> 
> 
> 
> -- 
> -
> Scott Brady
> http://www.scottbrady.net/
> 
> 
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333767
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-17 Thread Leigh

> I'd still like to know if there's a better way

I am not sure I understand the question.  Using cf_sql_timestamp for a 
date/time column is perfectly valid. So better than what ..? ;)


  


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333764
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


mySQL, datetime, and ColdFusion date objects

2010-05-17 Thread Scott Brady

I'm running into an issue I'm hoping others have seen.

We have a number of fields that need to be date times, and I'm getting this
type of error when trying to enter them into the database:
Data truncation: Incorrect datetime value: '{ts '2010-05-17 11:40:23'}' for
column 'modified' at row 1

If I change them to a time stamp (and set the sql type in the param to
cf_sql_timestamp) it works -- though, I'm not looking forward to changing
every single table that has these fields in them.  If I just leave the field
alone and change it to cf_sql_date, it works (though, as expected, doesn't
put the time part of the date time in there).

Is there some weirdness with ColdFusion date time objects and mySQL datetime
fields? (this is ColdFusion 9 and mySQL 5)

I could go through and change all of the fields to timestamps (except for
things like birthdate, but that can be just "date", since I believe
timestamp won't work for dates before 1970), but was hoping for an easier
option.

Thanks!

Scott

-- 
-
Scott Brady
http://www.scottbrady.net/


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333762
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: mySQL, datetime, and ColdFusion date objects

2010-05-17 Thread Scott Brady

Well, it looks like I can leave the field as a datetime but just use
cf_sql_timetamp in the queryparams.

I'd still like to know if there's a better way, but it's a lot easier to
search and replace that than to change every field in the database.

Scott

On Mon, May 17, 2010 at 11:48 AM, Scott Brady  wrote:

> I'm running into an issue I'm hoping others have seen.
>
> We have a number of fields that need to be date times, and I'm getting this
> type of error when trying to enter them into the database:
> Data truncation: Incorrect datetime value: '{ts '2010-05-17 11:40:23'}' for
> column 'modified' at row 1
>
> If I change them to a time stamp (and set the sql type in the param to
> cf_sql_timestamp) it works -- though, I'm not looking forward to changing
> every single table that has these fields in them.  If I just leave the field
> alone and change it to cf_sql_date, it works (though, as expected, doesn't
> put the time part of the date time in there).
>
> Is there some weirdness with ColdFusion date time objects and mySQL
> datetime fields? (this is ColdFusion 9 and mySQL 5)
>
> I could go through and change all of the fields to timestamps (except for
> things like birthdate, but that can be just "date", since I believe
> timestamp won't work for dates before 1970), but was hoping for an easier
> option.
>
> Thanks!
>
> Scott
>
> --
> -
> Scott Brady
> http://www.scottbrady.net/
>



-- 
-
Scott Brady
http://www.scottbrady.net/


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333758
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Coldfusion Date format question

2009-05-12 Thread fun and learning

Hi All,

Thanks a lot for the answers. It works now...

Thanks


> Using cfsqltype="cf_sql_timestamp" will definitely solve that problem.
> 
> 
> I expect you're just trying to give an example, but if all you're
> trying to do is move values from one table to another, you can do 
> this
> en-mass with SQL:
> 
> 
> insert into table2(date_field2)
> select date_field1 from table1
> 
> 
> Cheers,
> Kris
> 
> 
> > I have an issue inserting date and time together into a database 
> table from coldfusion.
> >
> > Right now, I am using  to get records from a particular 
> table, in which one of the field is date, and its value in the 
> database is something like
> > "2/14/2007 9:10:12 AM". I am performing insert operation into 
> another table which has to insert this date field into the column of 
> new table. I am doing currently as follow:
> >
> > 
> >   select date_field from table
> > 
> >
> > 
> >  
> >    insert into table2 (date_field1) values ( cfsqltype="cf_sql_date" value=#getDate.date_field#>)
> >  
> > 
> >
> > The problem with this is only the date is getting inserted but not 
> the time. How to format 


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322437
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Coldfusion Date format question

2009-05-11 Thread Kris Jones

Using cfsqltype="cf_sql_timestamp" will definitely solve that problem.

I expect you're just trying to give an example, but if all you're
trying to do is move values from one table to another, you can do this
en-mass with SQL:


insert into table2(date_field2)
select date_field1 from table1


Cheers,
Kris


> I have an issue inserting date and time together into a database table from 
> coldfusion.
>
> Right now, I am using  to get records from a particular table, in 
> which one of the field is date, and its value in the database is something 
> like
> "2/14/2007 9:10:12 AM". I am performing insert operation into another table 
> which has to insert this date field into the column of new table. I am doing 
> currently as follow:
>
> 
>   select date_field from table
> 
>
> 
>  
>    insert into table2 (date_field1) values ( cfsqltype="cf_sql_date" value=#getDate.date_field#>)
>  
> 
>
> The problem with this is only the date is getting inserted but not the time. 
> How to format 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322384
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Coldfusion Date format question

2009-05-11 Thread Dan Baughman

I believe the issue may be with your cfqueryparam tag.

You are using cf_sql_date, which to me implies only a date, not a time.
According to livedocs the CF_SQL_TIMESTAMP cfqueryparam is what maps to the
Microsoft SQL datetime type.

Dan

On Mon, May 11, 2009 at 1:37 PM, fun and learning
wrote:

>
> Hello All,
>
> I have an issue inserting date and time together into a database table from
> coldfusion.
>
> Right now, I am using  to get records from a particular table, in
> which one of the field is date, and its value in the database is something
> like
> "2/14/2007 9:10:12 AM". I am performing insert operation into another table
> which has to insert this date field into the column of new table. I am doing
> currently as follow:
>
> 
>   select date_field from table
> 
>
> 
>  
>insert into table2 (date_field1) values ( cfsqltype="cf_sql_date" value=#getDate.date_field#>)
>  
> 
>
> The problem with this is only the date is getting inserted but not the
> time. How to format this.
>
> It would be great if somebody can reply, I am not sure if my messages are
> getting posted, as I posted couple of issues I had some time back, but never
> got any reply back.
>
> Thanks.
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322380
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Coldfusion Date format question

2009-05-11 Thread Matt Quackenbush

You're telling CF to only insert the date (cf_sql_date).  Assuming that your
database column is setup to hold a timestamp (e.g. a data type of datetime,
timestamp or similar), try the following:




~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322379
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Coldfusion Date format question

2009-05-11 Thread John M Bliss

Use cfsqltype="CF_SQL_TIMESTAMP" and confirm that table2.date_field1 is of
type datetime.

On Mon, May 11, 2009 at 2:37 PM, fun and learning
wrote:

>
> Hello All,
>
> I have an issue inserting date and time together into a database table from
> coldfusion.
>
> Right now, I am using  to get records from a particular table, in
> which one of the field is date, and its value in the database is something
> like
> "2/14/2007 9:10:12 AM". I am performing insert operation into another table
> which has to insert this date field into the column of new table. I am doing
> currently as follow:
>
> 
>   select date_field from table
> 
>
> 
>  
>insert into table2 (date_field1) values ( cfsqltype="cf_sql_date" value=#getDate.date_field#>)
>  
> 
>
> The problem with this is only the date is getting inserted but not the
> time. How to format this.
>
> It would be great if somebody can reply, I am not sure if my messages are
> getting posted, as I posted couple of issues I had some time back, but never
> got any reply back.
>
> Thanks.
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322378
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Coldfusion Date format question

2009-05-11 Thread Nathan Strutz

For your cfqueryparam, cf_sql_date will insert literally only the date into
the database - instead, use cf_sql_timestamp.

nathan strutz
[Blog and Family @ http://www.dopefly.com/]
[AZCFUG Manager @ http://www.azcfug.org/]



On Mon, May 11, 2009 at 12:37 PM, fun and learning
wrote:

>
> Hello All,
>
> I have an issue inserting date and time together into a database table from
> coldfusion.
>
> Right now, I am using  to get records from a particular table, in
> which one of the field is date, and its value in the database is something
> like
> "2/14/2007 9:10:12 AM". I am performing insert operation into another table
> which has to insert this date field into the column of new table. I am doing
> currently as follow:
>
> 
>   select date_field from table
> 
>
> 
>  
>insert into table2 (date_field1) values ( cfsqltype="cf_sql_date" value=#getDate.date_field#>)
>  
> 
>
> The problem with this is only the date is getting inserted but not the
> time. How to format this.
>
> It would be great if somebody can reply, I am not sure if my messages are
> getting posted, as I posted couple of issues I had some time back, but never
> got any reply back.
>
> Thanks.
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322377
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Coldfusion Date format question

2009-05-11 Thread fun and learning

Hello All,

I have an issue inserting date and time together into a database table from 
coldfusion.

Right now, I am using  to get records from a particular table, in 
which one of the field is date, and its value in the database is something like 
"2/14/2007 9:10:12 AM". I am performing insert operation into another table 
which has to insert this date field into the column of new table. I am doing 
currently as follow:


   select date_field from table



  
insert into table2 (date_field1) values ()
  


The problem with this is only the date is getting inserted but not the time. 
How to format this. 

It would be great if somebody can reply, I am not sure if my messages are 
getting posted, as I posted couple of issues I had some time back, but never 
got any reply back.

Thanks. 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322376
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Coldfusion Date

2008-10-24 Thread Adrian Lynch
You'll have to nest some functions:



#DaysInMonth(CreateDate(2008, 3, 1))#



Adrian
Building a database of ColdFusion errors at http://cferror.org/

-Original Message-
From: Khaled SAIDI
Sent: 24 October 2008 09:23
To: cf-talk
Subject: Coldfusion Date

Hi the Community,

I just discover Coldfusion. It's really a so powerfull language that i would
like to ask if a function which take a month and a year as parameters and
return the number of days (for this month and this year) exist in
Coldfusion.

Thnx for future answers.

Khaled


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314337
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Coldfusion Date

2008-10-24 Thread Khaled SAIDI
Hi the Community,

I just discover Coldfusion. It's really a so powerfull language that i would 
like to ask if a function which take a month and a year as parameters and 
return the number of days (for this month and this year) exist in Coldfusion.

Thnx for future answers.


Khaled 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314336
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: php date to coldfusion date help

2007-09-30 Thread William Seiter
It looks like the double quotes is producing your problem.

They work fine when mimicking the original double quotes, however, the date
string did not originally have double quotes around it.

Try one of the versions below.  (the second one simplifies the dynamic date
to 2 calls instead of 6).


var servertimestring=(servermode==""server-php"")? '""#dateformat(now(),
'')# #dateformat(now(), 'D')#, #dateformat(now(), '')#
#timeformat(now(), 'H')#:#timeformat(now(), 'mm')#:#timeformat(now(),
'ss')#""' : (servermode==""server-ssi"")? '' : '<%= Now() %>'


var servertimestring=(servermode==""server-php"")? '#dateformat(now(), '
D, ')# #timeformat(now(), 'HH:mm:ss')#' : (servermode==""server-ssi"")?
'' : '<%= Now() %>'


Hope this helps

William 
-- 
William E. Seiter
 
Web Developer
http://William.Seiter.com
-Original Message-
From: Matthew Smith [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 29, 2007 3:01 PM
To: CF-Talk
Subject: php date to coldfusion date help

I am trying to use a countdown timer I found on the web for an event
countdown on one of our websites.  Unfortunately, the script only comes
setup for php and asp.  I am trying to substitute coldfusion variables into
the javascript instead of the php portion, but I am getting a NAN error from
the script output.

Here is the original line of code:
var servertimestring=(servermode=="server-php")? '' : (servermode=="server-ssi")? '' : '<%= Now() %>'

Here is what I came up with:
 var servertimestring=(servermode==""server-php"")? '""#dateformat(now(),
'')# #dateformat(now(), 'D')#, #dateformat(now(), '')#
#timeformat(now(), 'H')#:#timeformat(now(), 'mm')#:#timeformat(now(),
'ss')#""' : (servermode==""server-ssi"")? '' : '<%= Now() %>'

All the code is wrapped into a cfhtmlhead tag, which is why there are double
quotes("").

If anyone out there understands php enough to help me with the formatting,
that would be great.  The countdown is for an event tommorrow night so I'm
kind of pressed on this last minute request by the client.

Thanks! 



~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289809
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


php date to coldfusion date help

2007-09-29 Thread Matthew Smith
I am trying to use a countdown timer I found on the web for an event countdown 
on one of our websites.  Unfortunately, the script only comes setup for php and 
asp.  I am trying to substitute coldfusion variables into the javascript 
instead of the php portion, but I am getting a NAN error from the script output.

Here is the original line of code:
var servertimestring=(servermode=="server-php")? '' : (servermode=="server-ssi")? '' : '<%= Now() %>'

Here is what I came up with:
 var servertimestring=(servermode==""server-php"")? '""#dateformat(now(), 
'')# #dateformat(now(), 'D')#, #dateformat(now(), '')# 
#timeformat(now(), 'H')#:#timeformat(now(), 'mm')#:#timeformat(now(), 'ss')#""' 
: (servermode==""server-ssi"")? '' : '<%= Now() %>'

All the code is wrapped into a cfhtmlhead tag, which is why there are double 
quotes("").

If anyone out there understands php enough to help me with the formatting, that 
would be great.  The countdown is for an event tommorrow night so I'm kind of 
pressed on this last minute request by the client.

Thanks! 

~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289800
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4