Take a survey

Developing Applications Using APIs > Assembling PDF Documents > Adding and Manipulating Page Content > Using style profiles > Formatting dates

Formatting dates
The built-in keys _DateTime, _Created and _Modified can be used to specify dates within StyledText elements. These keys have an optional styleReference attribute that refers to a StyleProfile element. This StyleProfile element can contain as a child a DatePattern element that specifies formatting for the dates.
DatePattern can contain a number of child elements that represent the building blocks of a date string, along with text. The elements have mostly self-explanatory names such as Second, Minute, Hour, Year, and TimeZone. (See the Document Description XML Reference.) They take the current system time when the DDX document is processed and specify how to format it.
If only white space is required between two child elements, use the nonbreaking space entity number   or the Space element for the DatePattern element and rich text elements.
The default format in situations where DatePattern is not specified is equivalent to what is specified in this example:
Example: The default date pattern
<DatePattern>
	<Year/>-<MonthNumber01/>-<DayNumber01/>T<Hour01/>:
		<Minute00/>:<Second00/><UTCOffset/>
</DatePattern>
For example, Jan 3, 2006 at 12:01am PST would be formatted as
	2006-01-03T:00:01-0700
The following example specifies a header for all the pages in a source document. The Left element of the header specifies a formatted date string by means of a DateTime built-in key inside a StyledText element. The DateTime element refers to the StyleProfile whose name attribute is "greendate".
Example: Using a date pattern
<PDF result="doc2.pdf">
	<PageLabel prefix="page "/>
	<PDF source="doc1.pdf">
		<Header>
			<Left>
				<StyledText>
					<p color="green" font-weight="bold">
						<_DateTime styleReference="greendate"/>
					</p>
				</StyledText>
			</Left>
			<Center><StyledText><p>Confidential</p></StyledText></Center>
			<Right>
				<StyledText><p color="red"><_PageLabel/></p></StyledText>
			</Right>
		</Header>
	</PDF>
</PDF>
 
<StyleProfile name="greendate">
	<DatePattern xml:space="default">
		<DayNumber01/>&#160;<ShortMonthName/><Space/><Year/> at <Hour24/>:<Minute00/>
	</DatePattern>
</StyleProfile>
This DDX would result in a page header like this:
01 Jan 2001 at 14:03                   Confidential                   page 1 

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/assemblePDFPage_content.103.13.html