Q&A & More: How to Add [created_at] and [updated_at] Dates to your PDF Template

Last updated: April 25, 2021

Q&A and More

  • SOURCE: Support Forum
  • OUR RESPONSE TIME: 10 Minutes
  • USER'S REPLY/REVIEW: “That worked perfectly, thanks!

Question

Support forum user jstraete posted;

“I would like to output the date created and date last updated for a Formidable Form into a PDF template.
I do not have fields for those dates in my form, but I'm fairly certain they are stored in the database.
Is there any shortcode available to generate those dates?”

Answer

Yes,
Use Formidable Form's [created_at] and [updated_at] shortcodes.
To format the date, use Formidable Forms' default syntax: https://formidableforms.com/knowledgebase/advanced/#kb-date-format

More

The date format can also be in the form of Time Ago.

From Formidable Forms' support page;

Time Ago#

Display the amount of time between a saved date and today's date. You can use this with a date field, created_at, or updated_at shortcode. If using time_ago with created_at or updated_at, you may determine how many time measurements should appear.

For example, if there is a date selected that was almost 16 days away, various options will return different results. Here are a few examples:

Shortcode Result
[created_at time_ago=3]
2 weeks 1 day 23 hours
[created_at time_ago=1]
2 weeks
[created_at time_ago=week]
2 weeks
[created_at time_ago=day]
15 days
[created_at time_ago=hour]
383 hours

The time_ago option accepts the following values:

y or year: “# years”

m or month: “# months”

w or week: “# weeks”

d or day: “# days”

h or hour: “# hours”

m or minute: “# minutes”

s or seconds: “# seconds”

1, 2, 3, 4, 5, 6, or 7: Set the maximum number of units the result should return

Usage:

[125 time_ago=1]

or

[created_at time_ago=1]

Note: time_ago can only be used in Views, emails, and form success messages. If you want to calculate dates in a form, use the age shortcode.

In fact, nearly all of the Formidable Shortcodes and the Advanced Shortcodes may be used inside your PDF template!
Advanced Shortcodes in PDF

Image Credit: Formidable Forms' support page

Check out “How to Use Formidable Form Shortcodes in a PDF” for more tips on best practices and downloadable examples, on using Formidable shortcodes in PDF files.

 

 

0