Any Date, Any Format, Anywhere
With AnyDate, you can take a date (or date/time) written in plain language stored in a text field and convert it to Infusionsoft standard formatting for storage in a date or date/time field, and vice versa. AnyDate works with any text, date, or date/time field in any type of record, including opportunities, orders, and appointments. You can make an adjustment, such as adding one month, to the date or date/time before saving it. When using times, you can convert from one timezone to another.
Use cases
- Reschedule an appointment from an Infusionsoft form or a third party integration
- Combine last purchase date with field timer to reactivate customers who haven’t bought recently
- Format dates and times in multiple formats (including European) for use in emails, texts, and timers
- Change the date of a specific task or appointment from campaign builder
- Retroactively find and store date of last purchase by using Max function on orders
- Set warranty expiration date by adding months or years to purchase date
- Add last date a referral purchased to an affiliate’s record
- Add today’s date to a custom field only if it is blank
How to use it


Post URL
http://theapiguys.com/scripts/pocket-developer/Blocks/AnyDate/
Required Parameters
date |
One of the following:
Note:
|
format |
The format is made up of codes, specified by PHP. (Codes are date sensitive.)
Note:
|
saveTo |
This is the field where the result of the formatted date will be stored, such as Contact.Anniversary, Contact.Birthday, Contact._MyCustomDate or Contact._webinarPrettyDate. Do not put tildes (~) around the name of the field. Note: This parameter is optional if using ‘request’. |
Optional Parameters
time |
This value should be of the following:
Note:
|
adjustment |
The “adjustment” field should provide a relative date format string similar to PHP’s strtotime function. Some valid examples of this value are “+5 weeks” or “second month” or “last day of next month” or “yesterday noon”. (For more possible relative formats, see http://php.net/manual/en/datetime.formats.relative.php. |
timezone |
Note: Common Time Zones: United States |
convertToTZ |
|
request |
This is a URL to query at the end of the operation. The merge field {result} can be placed anywhere within the URL to include the result of the operation, allowing you to pass the value to another script. |
Notes
- If the saveTo field is a Date or DateTime field, you MUST use the Infusionsoft date/time format of Ymd\TH:i:s.
- Below is a summary of the most common date and time codes you can use in the format parameter of Any Date, Any Format, Anywhere. Remember they ARE CaSe sEnsItIVe:
DAYS
d – day of the month 2 digits (01-31)
j – day of the month (1-31)
D – 3 letter day (Mon – Sun)
l – full name of day (Monday – Sunday)
N – 1=Monday, 2=Tuesday, etc (1-7)
S – suffix for date (st, nd, rd)
w – 0=Sunday, 1=Monday (0-6)
z – day of the year (1=365)WEEK
W – week of the year (1-52)MONTH
F – Full name of month (January – December)
m – 2 digit month number (01-12)
n – month number (1-12)
M – 3 letter month (Jan – Dec)
t – Days in the month (28-31)
YEAR
L – leap year (0 no, 1 yes)
o – ISO-8601 year number (Ex. 1979, 2006)
Y – four digit year (Ex. 1979, 2006)
y – two digit year (Ex. 79, 06)TIME
a – am or pm
A – AM or PM
B – Swatch Internet time (000 – 999)
g – 12 hour (1-12)
G – 24 hour c (0-23)
h – 2 digit 12 hour (01-12)
H – 2 digit 24 hour (00-23)
i – 2 digit minutes (00-59)
s 0 2 digit seconds (00-59)
T – timezone (Ex: GMT, CST) - Date/Time Adjustments: Assuming date is 09/22/2014 and time is 08:00 and server is using Eastern Time Zone:
+1 day // returns 09/23/2014 08:00
+1 week // returns 09/29/2014 08:00
-17 hours // returns 09/21/2014 15:00
+1 week 2 days 4 hours 2 seconds // returns 10/01/2014 8:38 PM
next Thursday // returns 09/25/2014 00:00
last Monday // returns 09/15/2014 00:00
third Thursday of next month // returns 10/15/2014 00:00 - Supported Timezone Codes: In the event you can’t find a timezone for your region within the list below, you may also use any of the timezone identifiers supplied at this PHP documentation page; some examples of these identifiers are America/New_York, Canada/Atlantic, etc.
United States
Code Timezone, State, or Region Notes
ETUS Eastern Time No exclusions
CTUS Central Time No exclusions
MTUS Mountain Time Excluding Arizona
AZUS Arizona (No DST) No exclusions
PTUS Pacific Time No exclusions
ATUS Alaska Time No exclusions
HTUS Hawaii/Aleutian Time Excluding Honolulu
HONOUS Honolulu No exclusions
Australia
Code Timezone, State, or Region Notes
WTAU Western Australia Time; Western Australia Excluding Eucla
EUAU Eucla, Australia Time; Western Australia No exclusions
NCTAU North Central Australia Time; Northern Territory No exclusions
SCTAU South Central Australia Time; South Australia No exclusions
NETAU North Eastern Australia Time; Queensland No exclusions
SETAU South Eastern Australia Time;
New South Wales, Victoria, and Tasmania No exclusions
New Zealand
Code Timezone, State, or Region Notes
NZ New Zealand Time No exclusions
Europe
Code Timezone, State, or Region Notes
WTEU Western European Time Excluding Iceland
CTEU Central European Time No exclusions
ETEU Eastern European Time No exclusions
ICEEU Iceland (No DST) No exclusions
Canada
Code Timezone, State, or Region Notes
PTCA Pacific Time; Yukon and British Columbia No exclusions
MTCA Mountain Time;
part of Nunavut Northwest Territories,
Alberta, Saskatchewan No exclusions
CTCA Central Time;
part of Nunavut, Manitoba, some of Ontario No exclusions
ETCA Eastern Time;
most of Ontario, Quebec, Baffin Island No exclusions
ATCA Atlantic Time; Nova Scotia, New Brunswisk No exclusions
NTCA Newfoundland Time No exclusions
FAQ
Q. Can’t I do the same thing with PlusThis?
A. PlusThis can only do three things with dates (in the contact record only): humanize a date in one of seven pre-defined formats, add days or months to date and time fields (in the contact record only), and store in a field in the contact record, and calculate the time between two dates. Any Date, Any Format, Anywhere is much more flexible.
Any Date takes any field as input, in any table (e.g. Opportunity, Invoice, Company, Referral, Appointment, etc.) including text (e.g next Thursday or September 13). Any Date can adjust by anything from 1 nanosecond to 100 years. It can adjust up or down. It also can adjust a date or time forward or backward by a value in a field.
Any Date can store the result in any table, even those of contacts other than the one going through the campaign!