EasyCFM.COM ColdFusion Forums / Coding Help! / #ParseDate( ) Help

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: #ParseDate( ) Help

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

cybercompros
04-21-2004 @ 5:13 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 320
Joined: Feb 2004

Ok i took cjs suggestions and looked at the parsedate() function.  I was wondering if somone can help me figure it out.  am i supposed to use a regular expression or input mask.  Help please.  Here is what i tried!
#ParseDateTime((0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d [, pop-conversion ] )#

Which is a date conversion (regular expression).  But i get a big ole error!


Thank You,
Jordon Bedwell
Cybercom Pros
------------------------------
Planning Is Not Good In Design, You Must Have A Free Spirit!
------------------------------

Texas Design! Texas Pride!

wWw.JoRdOnBeDwElL.CoM

CJ
04-21-2004 @ 6:00 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

The function simply takes a date/time string as an argument.

parseDateTime()

<cfset myDate = "Monday May 5, 2007 5:45pm">
<cfset myNewDate = parseDateTime(myDate)>

<cfoutput>#dateFormat(myNewDate, 'mm/dd/yyyy')#</cfoutput>

i think should work.  honestly, i've never used the function myself Smile  



-CJ-
@ #coldfusion/DALNet
http://charlie.griefer.com

cybercompros
04-21-2004 @ 8:32 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 320
Joined: Feb 2004

When i did that i got 2004 """""""""""""""""""""""""
then it went down in a upside down triangle!

Thank You,
Jordon Bedwell
Cybercom Pros
------------------------------
Planning Is Not Good In Design, You Must Have A Free Spirit!
------------------------------

Texas Design! Texas Pride!

wWw.JoRdOnBeDwElL.CoM

cybercompros
04-21-2004 @ 8:36 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 320
Joined: Feb 2004

here is the source specific to that area         <cfif qGetMessages.RecordCount>
            <cfoutput query="qGetMessages">
              <tr bgcolor="###iif(currentrow MOD 2,DE('F7F7F7'),DE('EBEBEB'))#">
                <td width="21" align="center" valign="middle"><div align="center"><input type="checkbox" name="msgnumber" value="#qGetMessages.messagenumber#"></div></td>
                <td width="88" align="center" valign="middle"><div align="center">
#parseDateTime(#qGetMessages.date#, "mm/dd/yyyy") #mm/dd/yyyy##</div></td>
                <td width="312" align="center" valign="middle"><div align="center">#qGetMessages.from#</div></td>
              <td width="393" align="center" valign="middle"><div align="center">#qGetMessages.subject#</div></td>
                <td width="87" align="center" valign="middle"><div align="center"><a href="details.cfm?msgnumber=#qGetMessages.messagenumber#">View</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="inbox.cfm?action=delete&msgnumber=#qGetMessages.messagenumber#">Delete</a> </div></td>
              </tr>
            </cfoutput>
            <cfelse>


I tried it your way, then vamped it abit, and now i dont get that but i get a very strange looking time format!  Bold is the actual code!

Thank You,
Jordon Bedwell
Cybercom Pros
------------------------------
Planning Is Not Good In Design, You Must Have A Free Spirit!
------------------------------

Texas Design! Texas Pride!

wWw.JoRdOnBeDwElL.CoM

CJ
04-22-2004 @ 10:55 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

hmm...i'm surprised that isn't causing an error.  parseDateTime() takes one argument (the date string to be parsed).  

according to the dccs, it's similar to the createDate() function.  

you're trying to use parseDateTime() to add formatting, which would not be correct.  AFTER the parseDateTime() function, use a dateFormat() function.

see my example in my previous response.



-CJ-
@ #coldfusion/DALNet
http://charlie.griefer.com

cybercompros
04-22-2004 @ 11:27 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 320
Joined: Feb 2004

Like you said earlier im a lucky person.  Can I use ParseDateTime as an arguement or string to DateFormat.  So I can put it all in one Thing DateFormat(ParsedateTime(#qGetMessages.date#), "mm/dd/yyyy")#

Thank You,
Jordon Bedwell
Cybercom Pros
------------------------------
Planning Is Not Good In Design, You Must Have A Free Spirit!
------------------------------

Texas Design! Texas Pride!

wWw.JoRdOnBeDwElL.CoM

malk
04-22-2004 @ 9:09 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 35
Joined: Mar 2003

Hi Jordan,

Yes, you can combine the date parsing and formating but I'd change it slightly to:

#DateFormat(ParseDateTime(qGetMessages.date), "mm/dd/yyyy")#

I removed the hashes around qGetMessages.date - they are unnecessary around a variable unless you are trying to output the variable's value.

Cheers
- malk

cybercompros
04-23-2004 @ 12:23 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 320
Joined: Feb 2004

ha ha it finally worked thank you much!

Thank You,
Jordon Bedwell
Cybercom Pros
------------------------------
Planning Is Not Good In Design, You Must Have A Free Spirit!
------------------------------

Texas Design! Texas Pride!

wWw.JoRdOnBeDwElL.CoM


Website Designed and Developed by Pablo Varando.