Jump to content

Formatting Dates


Recommended Posts

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 by keangirl
Link to comment
Share on other sites

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


Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 months later...
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.

Link to comment
Share on other sites

  • 4 months later...

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...