Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting date time to show on cf output 1

Status
Not open for further replies.

gerendula

Programmer
Apr 17, 2006
13
GB
am trying to get a datetime readout through entering various variations of the datetime in the value of radio burttons which are then passed through cfparam and ~~ to then insert in a table

but i cannot do it

i need a step by step help in this

i dont think i am even doing the the cfset right
 
i have a form page with a set of radio bttns

atthe top tried to cfset your date=CreateODBCDateTime()
then entered yourDate in radion Bttns value

after sending it through cfparam on another page and outputing

i get createODBCDateTime

and and error from the CFINSert command at the bottoom of this page saying it cannot convert
The value"&CreateODBCDateTime()&" could not be converted to a date. />
essentially it needs toconvert to be inserted into a table on a database
 
gerendula, just out of curiousity are you wrapping your cfset tags with #-signs? CF needs that to process code. Typically cfset tags are used to asign values to that variable, but here seems you want to assign a processed value.

Like:
<cfset gM = #dateformat(now(),"mm/dd/yyyy")#>

And, you would output this tag on the screen as:
<cfoutput>The time is #gM#</cfoutput>



____________________________________
Just Imagine.
 
that actually rendered and i thought i could take it from there

but i am having two problems now

one i need to renderte date time liker this

0000-00-00 00:00:00'

and i am getting this
04-23-2006-13:58:41

am using this based on your suggestion

<cfset gM = #dateformat(now(),"mm-dd-yyyy")#>
<cfset gP = #timeformat(now(), "HH:mm:ss")#>


on top of that i then will need to do dateadd to these for other radio bttn options

how do i get the date time to read the right way
and then after that how do i do

it so that i can add the days


example of radio bttns code that i am trying to make work
<p>Predating of Order Purchase is only allowed up to four days in advance.</p>
Purchase Date:--Today--<INPUT TYPE="radio"
NAME="PurchaseDate"
VALUE="#gM#-#gP#"
CHECKED>
Tomorrow--<INPUT TYPE="radio"
NAME="PurchaseDate"
VALUE="">
In Two Days--<INPUT TYPE="radio"
NAME="PurchaseDate"
VALUE="">
<BR><BR>

if u could make any suggestions it would help ta gerendula

 
tried this

<cfset gT = #dateformat(dateadd("d",1,now(),"yyyy-mm-dd"))#>

and got this error

Invalid CFML construct found on line 23 at column 8.


?/??????????
 
got the datetime to read the right way though

thanksguju
 
gerendula, glad I could have helped. So you're all set with your problem right? You got the date to display the way you want, right??

____________________________________
Just Imagine.
 
thanks can u look at the one i posted with the dateadd it will not operate
yert my book says this is how it will work

<cfset gT = #dateformat(dateadd("d",1,now(),"yyyy-mm-dd"))#>

and got this error

Invalid CFML construct found on line 23 at column 8.

thanks gerendula
 
same as before for the radio bttns

Like:
<cfset gM = #dateformat(now(),"mm/dd/yyyy")#>

And, you would output this tag on the screen as:
<cfoutput>The time is #gM#</cfoutput

but i need to add days for it to output the date tow or more days away
i tried this

<
<cfset gT = #dateformat(dateadd("d",1,now(),"yyyy-mm-dd"))#>

and got this error

Invalid CFML construct found on line 23 at column 8.


any ideas


geredula


 
the error is correct, your code has incorrect nesting of the functions

Code:
<cfset gT = dateformat(dateadd("d",1,now()),"yyyy-mm-dd")>

try that and let me know how that works out.

=========================================
Don't sweat the petty things and don't pet the sweaty things.
 
gerendula, NorthStarDA's solution will work, but don't call the variable "gT" because that's a restricted keyword in CF. gT means greater then, :)

____________________________________
Just Imagine.
 
thanks guju and northstar

worked a treat

brackets who would have them

ta

gerendula
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top