Re: Date format question
Perhaps suggest ParseExact to him: http://www.codeproject.com/KB/cs/String2DateTime.aspx On Tue, Jan 5, 2010 at 4:14 AM, Stefan Richter ste...@flashcomguru.comwrote: My CF app stores dates in a MySQL database which I often submit simply using NOW() in my SQL statement. The resulting database entry has this format: 2008-01-29 11:08:40 Other times I am using a default MYSQL value of CURRENT_TIMESTAMP in a timestamp field, which results in the same format. I have a public API which returns the date in the same format. Now one of my clients told me this: .Net functions do not recognize the date/time strings that the API returns making all date/times invalid. Is that really the case? Am I doing something wrong, or is he? Regards, Stefan ~| 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:329412 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Date format question
I would say that the client who is using your api is not using the datetime.parse method in .net which allows you to add a culture specific format when a string date is parsed. the .NET parse method is an overloaded .NET method that can either take the following forms. Parse(String) http://msdn.microsoft.com/en-us/library/1k1skd40.aspx Parse(String, IFormatProvider)http://msdn.microsoft.com/en-us/library/kc8s65zs.aspx Parse(String, IFormatProvider, DateTimeStyles)http://msdn.microsoft.com/en-us/library/ey1cdcx8.aspx Regards Gary Gilbert http://www.garyrgilbert.com/blog On Tue, Jan 5, 2010 at 11:14 AM, Stefan Richter ste...@flashcomguru.comwrote: My CF app stores dates in a MySQL database which I often submit simply using NOW() in my SQL statement. The resulting database entry has this format: 2008-01-29 11:08:40 Other times I am using a default MYSQL value of CURRENT_TIMESTAMP in a timestamp field, which results in the same format. I have a public API which returns the date in the same format. Now one of my clients told me this: .Net functions do not recognize the date/time strings that the API returns making all date/times invalid. Is that really the case? Am I doing something wrong, or is he? Regards, Stefan ~| 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:329413 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Date Format Question
Date = parseDateTime(Rereplace(date, ^([0-9]{4}):([0-9]{2}):(.*)$, \1/\2/\3)); Date = dateFormat(date, ...); You might be able to get by with removing either parseDateTime() or the Rereplace(), but I'm not 100% sure. Cheers, barneyb -Original Message- From: Jeff Fongemie [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 17, 2004 8:29 AM To: CF-Talk Subject: Date Format Question I've got a date-time that is goinmg to be passed to me as this: 2003:12:27 12:19:58 Can anyone suggest the best way to get that into a more friendly format as in.. 12/27/03 12:19pm ?? It obviously won't fit into standard dateformat function. Any ideas I can come up with are complicated. There must be an easy solution? Jeff F [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Date Format Question
Jeff Fongemie said: I've got a date-time that is goinmg to be passed to me as this: 2003:12:27 12:19:58 Can anyone suggest the best way to get that into a more friendly format as in.. 12/27/03 12:19pm ?? It obviously won't fit into standard dateformat function. Any ideas I can come up with are complicated. There must be an easy solution? theDate = REReplace(input, ^([0-9]*):([0-9]*):(.*)$,\1-\2-\3); Jochem [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Date Format Question
It changes the colons to hypens. --Ben Doom Jeff Fongemie wrote: Am I missing something? I've got: cfset mydate=#myexifinfo.DateTimeOriginal# Original Date:#REReplace(mydate, ^([0-9]*):([0-9]*):(.*)$,\1-\2-\3)# This gives me exactly the same date time format as I input? The regex does not change anything? [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Date Format Question
what about cfset myDate = replace(listFirst(2003:12:27 12:19:58, ), :, /, all) cfset myDate = createDate(listFirst(myDate, /), listGetAt(myDate, 2), listLast(myDate, /)) cfset myTime = listLast(2003:12:27 12:19:58, ) #dateFormat(myDate, dd/mm/yy)# #timeFormat(myTime, hh:mm tt)# Taco Fleur Bloghttp://www.tacofleur.com/index/blog/ http://www.tacofleur.com/index/blog/ Methodology http://www.tacofleur.com/index/methodology/ Tell me and I will forget Show me and I will remember Teach me and I will learn -Original Message- From: Jeff Fongemie [mailto:[EMAIL PROTECTED] Sent: Wednesday, 18 February 2004 2:29 AM To: CF-Talk Subject: Date Format Question I've got a date-time that is goinmg to be passed to me as this: 2003:12:27 12:19:58 Can anyone suggest the best way to get that into a more friendly format as in.. 12/27/03 12:19pm ?? It obviously won't fit into standard dateformat function. Any ideas I can come up with are complicated. There must be an easy solution? Jeff F _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]