Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Dates

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 29th, 2010, 12:08 PM
keangirl keangirl is offline
Forum n00b
 
Join Date: Mar 2010
Posts: 2
Default Formatting Dates

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?

Last edited by keangirl; March 29th, 2010 at 12:40 PM..
Reply With Quote
  #2  
Old March 29th, 2010, 12:53 PM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: Formatting Dates

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...
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
  #3  
Old March 29th, 2010, 12:56 PM
keangirl keangirl is offline
Forum n00b
 
Join Date: Mar 2010
Posts: 2
Default Re: Formatting Dates

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.
Reply With Quote
  #4  
Old March 29th, 2010, 01:07 PM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: Formatting Dates

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).
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
  #5  
Old March 29th, 2010, 02:47 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,320
Default Re: Formatting Dates

Quote:
Originally Posted by keangirl View Post
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:
Code:
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.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #6  
Old June 8th, 2011, 12:14 PM
JCrocker JCrocker is offline
Junior Community Member
 
Join Date: Jan 2011
Location: North Carolina
Posts: 39
Exclamation Re: Formatting Dates

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
Reply With Quote
  #7  
Old June 8th, 2011, 12:57 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,320
Default Re: Formatting Dates

Quote:
Originally Posted by JCrocker View Post
return FormatDate(Field("Field13", "mm/dd"));
Your syntax is wrong. The first closing parend needs to go before the comma, like so:
Code:
return FormatDate(Field("Field13"), "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.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #8  
Old October 25th, 2011, 06:35 AM
n2_space n2_space is offline
Regular Contributor
 
Join Date: Jul 2011
Posts: 53
Default Re: Formatting Dates

I'm confused, seeing what is written above I put this in:

Quote:
return FormatDate(Field("INJECTION DATE"), "mm/dd/yyyy");
but it does not work.... thoughts?
Reply With Quote
  #9  
Old October 25th, 2011, 08:58 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,320
Default Re: Formatting Dates

Quote:
Originally Posted by n2_space View Post
I'm confused, seeing what is written above I put this in:
Code:
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:
Code:
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.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #10  
Old February 28th, 2012, 02:29 PM
WestPress WestPress is offline
Junior Community Member
 
Join Date: Sep 2008
Location: Tucson, AZ
Posts: 28
Default Re: Formatting Dates

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/showthre...=8085#poststop
__________________
Mac OS X v10.6.7
FusionPro (Designer/Desktop v7.1P1c)
Adobe Acrobat Pro v9.4.5
Adobe InDesign CS5 v7
Reply With Quote
Reply

Tags
date, format date

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:55 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.