keangirl Posted March 29, 2010 Share Posted March 29, 2010 (edited) I'm a new user and would like to make sure that dates on a certain document are displayed as follows: January 3, 2010. I don't want 01/03/10 or any version of that kind of date display. What would be the best way to go about this? I'm not sure and this is my first document. Any advice? Edited March 29, 2010 by keangirl Quote Link to comment Share on other sites More sharing options...
esmith Posted March 29, 2010 Share Posted March 29, 2010 It would be easy enough to create a JS rule that would convert data from the mm/dd/yy format to a "longhand" format, but not as easy if data is received in a different format from record to record. Will all data be received in the mm/dd/yy format? As opposed to the following scenario: R1 - 01/03/10 R2 - January 3, 2010 R3 - January 3rd 2010 R4 - Jan 3, 2010 R5 - 1.3.10 etc... Quote Link to comment Share on other sites More sharing options...
keangirl Posted March 29, 2010 Author Share Posted March 29, 2010 I'm wondering if I should not allow the users to input a date but rather select from a calendar and have that date popluate into the document in the specific format I'm wanting. It seems easier to control the input that way but I'm not exactly sure how to go about that. Its been too long since my training at Printable and there are huge gaps in my notes. I've looked through the online users guide and the one I got in class but can't find what I'm looking for. Quote Link to comment Share on other sites More sharing options...
esmith Posted March 29, 2010 Share Posted March 29, 2010 Are you using MarcomCentral? If so, I would repost this question in that forum since I don't use that specific product. I would think that you would have the ability when setting up the input fields to require information to be entered in a specific format (i.e. mm/dd/yy validates, but Jan 3, 2010 does not and possibly returns an error message). Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 29, 2010 Share Posted March 29, 2010 I'm a new user and would like to make sure that dates on a certain document are displayed as follows: January 3, 2010. Something like this: return FormatDate(Field("YourFieldName", "lm d, yyyy"));Once you have a valid Date object, the FormatDate function can be used to output into almost any format you desire. Please refer to the FusionPro Rules System Guide for more information. As Eric alluded to, the format of the input data field may be significant, but the DateFromString and FormatDate functions should handle most common cases. Although it's always best to avoid any possible ambiguity issues: the most common ones are the good old Y2K bug with two-digit year specifications, and confusion between day and month numbers (e.g. "10/3" is generally understood as October 3rd in the U.S., but as March 10th in the U.K.). Exactly how you would get the input data into a specific format from a user web form is beyond the scope of this forum. As Eric said, if you're asking about MarcomCentral, please post in that forum. Quote Link to comment Share on other sites More sharing options...
JCrocker Posted June 8, 2011 Share Posted June 8, 2011 Hey Dan, I am having some trouble formatting some dates. I found this thread and FP seems to think it is ok but is returning the incorrect information. For example: Using this code: return FormatDate(Field("Field13", "lm d, yyyy")); Field13 being 5/17/2011 FP returns u017efi0e17 Im actually just trying to get it to return the month and day which i believe would be: return FormatDate(Field("Field13", "mm/dd")); Field13 being 5/17/2011 it still returns u017efi0e17 the same thing Any Ideas or suggestions anyone Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 8, 2011 Share Posted June 8, 2011 return FormatDate(Field("Field13", "mm/dd")); Your syntax is wrong. The first closing parend needs to go before the comma, like so: return FormatDate(Field("Field13"[color=SeaGreen]),[/color] "mm/dd");The Field function takes one parameter, and the FormatDate function takes two. You were passing two parameters to Field (the second of which was ignored), and only one to FormatDate. I suppose the FormatDate function should throw a more meaningful error in this case. Quote Link to comment Share on other sites More sharing options...
n2_space Posted October 25, 2011 Share Posted October 25, 2011 I'm confused, seeing what is written above I put this in: return FormatDate(Field("INJECTION DATE"), "mm/dd/yyyy"); but it does not work.... thoughts? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 25, 2011 Share Posted October 25, 2011 I'm confused, seeing what is written above I put this in: return FormatDate(Field("INJECTION DATE"), "mm/dd/yyyy"); but it does not work.... thoughts? What's the value of the data field? You might need to do this instead: return FormatDate(DateFromString(Field("INJECTION DATE")), "mm/dd/yyyy"); But that still might not work, depending on what's in the data. You might need some custom parsing code. Quote Link to comment Share on other sites More sharing options...
WestPress Posted February 28, 2012 Share Posted February 28, 2012 Hey keangirl, not sure if you saw this post or not, or even if you still need it, but this is an awesome library for formatting dates that I use: http://forums.printable.com/showthread.php?p=8085#poststop Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.