JerrySalem Posted September 5, 2003 Posted September 5, 2003 Hey all. I have a FM database that I a currently serving using custom web publishing. When a user creates a new record it is date and time stamped. I am currently displaying the date and time the record was created using CDML, something like record created [FMP-Field: issued date] at [FMP-Field: issuedtime] the resulting text on the web page looks something like this: record created 2/21/2003 at 2:12:04 AM QUESTION how can I manipulate the format? I would love to see something more like: Record created Febuary 21, 2003 at 2:12 AM TIA JErry
Garry Claridge Posted September 5, 2003 Posted September 5, 2003 Try: [FMP-Field: issued date, Format] This should use the format from your Layout. Good Luck. Garry
JerrySalem Posted September 5, 2003 Author Posted September 5, 2003 Thanks, It is a wonder this isn't in the CMDL companion. Jerry
Unable Posted September 5, 2003 Posted September 5, 2003 And if that does not work you may want to enlighten yourself with this Tech. Article 106231 from FMI which is rather blunt, "When viewed with a web browser, time fields are displayed in 24-hour format. There are no cdml or html tags to display the time fields in 12-hour am/pm format." It also provides a clue as to what to do. Just make sure your calculations are unstored. It fails to mention the elimination of the seconds, but you can figure that out easily enough.
Unable Posted September 5, 2003 Posted September 5, 2003 Jerry, to make it easy for you (and others) I have posted a demo on the Sample Files forum. Yeah, it's cool.
Anatoli Posted September 6, 2003 Posted September 6, 2003 Format was first mentioned here http://www.fmforums.com/threads/showflat.php?Cat=&Board=UBB22&Number=42044&Forum=All_Forums&Words=Format%5D&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=allposts&Main=22098&Search=true#Post42044 by me
Unable Posted September 6, 2003 Posted September 6, 2003 Yes, the parameter "format" is valuable - when it works. Regrettably, it seems to not work in all situations. In the example which I posted in Sample Files (FMPro 5.0v.3) the code [fmp-field:d_today,format] (which in my haste I did mis-identify on the browser page as d_today00) displays the date on the browser as 9/6/2003, yet the date field in the db file is formatted to display the date as September 6, 2003. Similarly the code [fmp-field:d_now,format] displays the time as 13:31:21 on the browser page yet the time field in the db file is formatted to display 1:31 PM. Jerry's query included, I would love to see something more like: Record created Febuary 21, 2003 at 2:12 AM According to the demonstration which I posted the parameter "format" does not address Jerry's issue. Unstored calculations do. I would suggest that by using calculation fields, formatting for American or European dates is relatively simple and straightforward. From the same date field, two calcs could allow the display of both date formats on the same browser page. Wow, talk about international appeal for your site. Can you do that with the parameter "format" on a date field? I think not.
Garry Claridge Posted September 6, 2003 Posted September 6, 2003 Using: [FMP-Field:mydate, Format] at [FMP-Field:mytime, Format] works for me. It gives: September 7, 2003 at 08:00 AM I've formatted the fields "mydate" and "mytime" how I wanted them on the Layout and this is the way they are displayed on the browser page. Good Luck. Garry p.s. I should have given credit to Anatoli for the discovery of this un-documented feature. p.p.s I am using FM 6.0v4
Unable Posted September 7, 2003 Posted September 7, 2003 re: p.p.s I am using FM 6.0v4 Thanks for the info. I guess that represents one of the new features of 6 which is not in 5.0. Many would be very frustrated with the results of using "format" as it is recommended above (not version specific). They might not otherwise be aware of the solution which I presented. I hope it save a few some frustration.
Anatoli Posted September 7, 2003 Posted September 7, 2003 RE: p.s. I should have given credit to Anatoli for the discovery of this un-documented feature. I didn't discover that; I only posted it here first It shows the amazing usefulness of this forum! Because for many of us the CDML Reference database is "the holy book", what is not in CDML RD is ignored or not know at all. While working in LA, I was modifying some old CDML code, not very optimized, sometimes like "spagethi code in BASIC". The programmer, BTW from Mexico, who authored that code was excellent, but CDML was probably not his/hers strongest skill. And there it was, sitting in code and for that purpose worked brilliantly. FORMAT! Before that I was always forced to use calculation field in FM. So in next topic started by "cinolas" I've posted that gem
Recommended Posts
This topic is 7740 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now