Newbies dazzjazz Posted December 11, 2002 Newbies Posted December 11, 2002 Is there any way to force the correct date format when CDML is written to the HTML page ? I need to pull a date field out of FM5 in the format dd/mm/yyyy - which is the format it's stored in the database. however, any leading zeros are being stripped ie 02/02/2003 become 2/2/2003. Is there any way to force the correct format when CDML is written to the HTML page ? Dazzjazz
Steve T. Posted December 11, 2002 Posted December 11, 2002 dazzjazz There's a whole slew of date-related posts that I cannot remember exactly but I do recall mention that FM date format is dependent upon your own computer's date format... it's not a FM thing (although there were Euro/U.S. issues). Maybe your own computer can be set to store it that way so you don't have to reformat it. Or maybe you can convert it to a text field and use a calc field to manipulate it to look the way you want. If not, I'm sure someone can help you using JavaScript or something. Anyone else out there have a lead for dazzjazz?
Garry Claridge Posted December 11, 2002 Posted December 11, 2002 Try: [FMP-Field:myDate,format] Good Luck Garry
Leb i Sol Posted April 8, 2003 Posted April 8, 2003 hello all + Garry! this:[FMP-Field:myDate,format] works just fine but is there a way to assign it as the part of the varible in JavaScript..... if you remember the part: curr_date = "[FMP-Field:Date,format]"; .... .... document.write(" + curr_date + ") however, the write part doesn't work?! Is there a trick to this thank you!
Garry Claridge Posted April 8, 2003 Posted April 8, 2003 What happens when you try this: document.write(curr_date); Good Luck. Garry
Leb i Sol Posted April 8, 2003 Posted April 8, 2003 noting really happens...the doc.write doesn't create any output...the page is opened by noting written. I can't use just document.write(curr_date) because the string is a bit longer, I just posted the part of it. here is the entire string: document.write("<tr><td background='/images/line.jpg' height='22'><strong><a href="#" onclick="showdetails('" + curr_date + "','"+ curr_loc +"');">" + curr_date + "</strong></td><td background='/images/line.jpg' height='22' align='center'>" + loc_qty + "</td><td background='/images/line.jpg' height='22'> $ " + loc_amnt + "</td></tr>"); the problem/issue starts arround that showdetails(... maybe you can help... thank you sir!
Leb i Sol Posted April 9, 2003 Posted April 9, 2003 just wanted to keep the post going...I am still looking for an answer to this JavaScript issue! Any gurus outhere?
Garry Claridge Posted April 9, 2003 Posted April 9, 2003 When you view the source of the page, after it is loaded into the browser, what does this look like: curr_date = "[FMP-Field:Date,format]" Does it look like this: curr_date = "Apr 8 2003" (or something similar) Good Luck. Garry
Leb i Sol Posted April 9, 2003 Posted April 9, 2003 "Thu,Dec 25,1997" ...I am not quite sure if I can "mix" text and digits like this Thank you Sir!
Garry Claridge Posted April 10, 2003 Posted April 10, 2003 Here is a "hard-wired" version which works: <html lang="en"> <head> <title>test3</title> <meta name="generator" content="BBEdit 7.0.3"> <script> function showdetails(currdate,currloc) { alert(currdate + "<br>" + currloc); }; </script> </head> <body>Loading... <table> <script> curr_date = "Thu,Dec 25,1997"; curr_loc = "Anywhere"; loc_qty = 200; loc_amnt = 1000; document.write("<tr><td height='22'><strong><a href="#" onclick="showdetails('" + curr_date + "','"+ curr_loc +"');">" + curr_date + "</strong></td><td height='22' align='center'>" + loc_qty + "</td><td height='22'> $ " + loc_amnt + "</td></tr>"); </script> </table></body> </html> Good Luck. Garry
Leb i Sol Posted April 10, 2003 Posted April 10, 2003 so in other words...it should work the same with JS loop. Ok, thank you Garry ... I will "comb" my code for errors.
Leb i Sol Posted April 10, 2003 Posted April 10, 2003 should = does not I don't know what to say...If I change curr_date = "[FMP-Field:Date]"; to curr_date = "[FMP-Field:Date,format]"; none of the document.write statements work/get executed....remove the format part and all is OK!? I can get it to work under "normal" circumstances such as form/inline --> submit-->results: [FMP-Record] [FMP-Field:Date,format] [/FMP-Record] one of those things.....I guess
Unable Posted April 10, 2003 Posted April 10, 2003 I'm just a curious bystander. What would happen if you tried curr_date = "[FMP-Field:Date,raw]"; ?
Garry Claridge Posted April 11, 2003 Posted April 11, 2003 Does, "Format" work with a Date field? Garry
Anatoli Posted April 11, 2003 Posted April 11, 2003 My Golden Rule: If something doesn't work on web, create calculation text field with required output. It works in all web situation from WC to Lasso.
Leb i Sol Posted April 11, 2003 Posted April 11, 2003 no Lasso for me....[FMP-Record:my boss does not want to pay for nothing...why do you think his netadmin is doing webdesign]
Unable Posted April 11, 2003 Posted April 11, 2003 So if contributors to these forums no longer provide you with free help which results in you spending greater time to accomplish the things you post about, will your boss gain a better understanding of economics or fire you and hire someone even cheaper, albeit less knowledgeable? We all understand that your boss won't (can't) do the job.
Garry Claridge Posted April 11, 2003 Posted April 11, 2003 I sometimes use the Calculated field method for formating data. You can also use Javascript. Here is some code I use for testing date formatting: <body><script> [FMP-Record] mydate = "[FMP-Field:last_app]".split("/"); myday = mydate[0]; mymonth = mydate[1]; myyear = mydate[2]; testdate = new Date("[FMP-Field:last_app]"); document.write("Day is " + myday + " Month is " + mymonth + " Year is " + myyear + "<br>"); document.write("My date is " + testdate.toLocaleString() + "<br>"); [/FMP-Record]</script> </body> Hope this is of interest. Garry
Leb i Sol Posted April 17, 2003 Posted April 17, 2003 UNABLE: yeah...I wish he just hired FM programmer at the begining of FM saga. In that case all I would worry about is opnening the ports and running backups but then again I would have never joined this forum...met bunch of nice people...and above all learned something new in life (easy or the hard way) which is why I raised my hand for the job in the first place! p.s. forum is MY tool not his...
Recommended Posts
This topic is 7960 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