Date
Extends JavaScript Date Object for Adobe Acrobat
Item Index
Methods
- changeBy
- changeByDays
- changeByHours
- changeByMilliseconds
- changeByMinutes
- changeByMonths
- changeBySeconds
- changeByWeeks
- changeByYears
- daysBetween
- getAge static
- getAgeFromString static
- getDayName
- getDayOfYear
- getDaysInMonth static
- getMonthName
- getWeekOfYear
- isLeapYear static
- max static
- millisecondsElapsed
- min static
- nextMonth
- nextWeekDay
- reset
- toFormattedString
Methods
changeBy
-
oChange
Modifies this Date instance by the change specified in the object passed
Parameters:
Returns:
The modified Date object
Example:
today = new Date(); var change = { "years":3, "days":2, "hours":6 }; today.changeBy(change); event.value = today.toFormattedString(Date.SORTABLE_DATETIME);
changeByDays
-
days
Adds or subtracts days from this Date instance
Parameters:
Returns:
The adjusted Date instance
changeByHours
-
hours
Adds or subtracts hours from this Date instance
Parameters:
Returns:
The adjusted Date instance
changeByMilliseconds
-
milliseconds
Adds or subtracts milliseconds from this Date instance
Parameters:
Returns:
The adjusted Date instance
changeByMinutes
-
minutes
Adds or subtracts minutes from this Date instance
Parameters:
Returns:
The adjusted Date instance
changeByMonths
-
months
Adds or months days from this Date instance
Parameters:
Returns:
The adjusted Date instance
changeBySeconds
-
seconds
Adds or subtracts seconds from this Date instance
Parameters:
Returns:
The adjusted Date instance
changeByWeeks
-
weeks
Adds or weeks days from this Date instance
Parameters:
Returns:
The adjusted Date instance
changeByYears
-
years
Adds or years days from this Date instance
Parameters:
Returns:
The adjusted Date instance
daysBetween
-
aDate
-
anotherDate
Returns the number of days between two Date instances.
Parameters:
Returns:
The value will always be positive.
getAge
-
dateOfBirth
Returns the number of years between today and the Date instance passed.
Parameters:
Returns:
getAgeFromString
-
dateOfBirth
-
[format]
Returns the number of years between today and the Date instance passed.
Parameters:
Returns:
getDayName
-
[bShort]
Returns the day of the week for this Date instance
Parameters:
Returns:
The name of the week
getDayOfYear
()
Number
Gets the numeric day of the year
Returns:
Returns a Number corresponding to the number of days since the beginning of the year
getDaysInMonth
-
nYear
-
nMonth
Gets the number of days in the month, given a year and month . Automatically corrects for LeapYear.
Parameters:
Returns:
The number of days in the month.
getMonthName
-
[bShort]
Returns the month name or this Date instance
Parameters:
Returns:
The name of the month
getWeekOfYear
-
nWeekStartDay
Get the week number. Week one (1) is the week which contains the first Thursday of the year. Monday is considered the first day of the week. The .getWeek() function does NOT convert the date to UTC. The local datetime is used.
Parameters:
Returns:
1 to 53
isLeapYear
-
year
Determines if the current date instance is within a LeapYear.
Parameters:
Returns:
true if date is within a LeapYear, otherwise false.
Example:
var leapYear = Date.isLeapYear(2016);
max
-
dates
Returns the latest of the given Date instances
Parameters:
Returns:
Example:
// Custom calculation for an Acrobat Text field var dates = [ ]; dates.push( new Date( "1956/08/05" ) ); dates.push( new Date( "1960/12/19" ) ); dates.push( new Date( "1961/08/14" ) ); dates.push( new Date( "1958/04/29" ) ); dates.push( new Date( "1954/09/30" ) ); dates.push( new Date( "1957/11/07" ) ); var youngestSibling = Date.max(dates); event.value = youngestSibling.toFormattedString( Date.SHORT_DATE )
millisecondsElapsed
-
Defaults
Returns the number of milliseconds between this Date instance and the date parameter.
Parameters:
Returns:
The difference in milliseconds. Return value will always be positive.
min
-
dates
Returns the earliest of the given Date instances
Parameters:
Returns:
Example:
// Custom calculation for an Acrobat Text field var dates = [ ]; dates.push( new Date( "1956/08/05" ) ); dates.push( new Date( "1960/12/19" ) ); dates.push( new Date( "1961/08/14" ) ); dates.push( new Date( "1958/04/29" ) ); dates.push( new Date( "1954/09/30" ) ); dates.push( new Date( "1957/11/07" ) ); var oldestSibling = Date.min(dates); event.value = oldestSibling.toFormattedString( Date.SHORT_DATE )
nextMonth
()
Date
Sets the date of this Date instance to the first day of the following month.
Returns:
The first day of the following month. If true is passed as the parameter, the first business day. Business days being Monday through Friday.
nextWeekDay
()
Date
Sets the date of this Date instance to the following weekday. Weekdays being Monday through Friday
Returns:
The following day if the current date is Monday through Thursday. Returns the coming Monday if the current day is Friday through Sunday.
Example:
d = new Date().nextWeekDay(); event.value = d.toFormattedString(Date.LONG_DATE);
reset
()
Date
Resets the time of this Date object.
Returns:
Date object for the same day but with time set to 12:00 AM (00:00), which is the start of the day.
toFormattedString
-
cFormat
Format this Date instance to a string
Parameters:
Returns:
Example:
var d = new Date(); var myString = d.toFormattedString(Date.YEAR_MONTH);
Properties
FULL_DATETIME
String
The time format "dddd, mmmm dd, yyyy h:MM:ss tt"
"tt" indicates am/pm
Example:
var d = new Date(); var myString = d.toFormattedString(Date.FULL_DATETIME);
LONG_DATE
String
The date format "dddd, mmmm, dd, yyyy"
Example:
var d = new Date(); var myString = d.toFormattedString(Date.LONG_DATE);
LONG_TIME
String
The time format "h:MM:ss tt
"tt" indicates am/pm
Example:
var d = new Date(); var myString = d.toFormattedString(Date.LONG_TIME);
MONTH_DAY
String
The time format "mmmm dd"
Example:
var d = new Date(); var myString = d.toFormattedString(Date.MONTH_DAY);
PPDF_VERSION
String
The version of this API
SHORT_DATE
String
The date format "m/d/yyyy"
Example:
var d = new Date(); var myString = d.toFormattedString(Date.SHORT_DATE);
SHORT_TIME
String
The time format "h:MM tt"
"tt" indicates am/pm
Example:
var d = new Date(); var myString = d.toFormattedString(Date.SHORT_TIME);
SORTABLE_DATETIME
String
The time format "yyyy-mm-dd HH:MM:ss"
Example:
var d = new Date(); var myString = d.toFormattedString(Date.FULL_DATETIME);
YEAR_MONTH
String
The time format "yyyy mmmm"
Example:
var d = new Date(); var myString = d.toFormattedString(Date.YEAR_MONTH);