Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Format of a Date and Time fields

Featured Replies

Hey all.

I have a FM database that I a currently serving using custom web publishing.

When a user creates a new record it is date and time stamped.

I am currently displaying the date and time the record was created using CDML, something like

record created [FMP-Field: issued date] at [FMP-Field: issuedtime]

the resulting text on the web page looks something like this:

record created 2/21/2003 at 2:12:04 AM

QUESTION

how can I manipulate the format? I would love to see something more like:

Record created Febuary 21, 2003 at 2:12 AM

TIA

JErry

Try:

[FMP-Field: issued date, Format]

This should use the format from your Layout.

Good Luck.

Garry

  • Author

Thanks, It is a wonder this isn't in the CMDL companion.

Jerry

And if that does not work you may want to enlighten yourself with this Tech. Article 106231 from FMI which is rather blunt, "When viewed with a web browser, time fields are displayed in 24-hour format. There are no cdml or html tags to display the time fields in 12-hour am/pm format."

It also provides a clue as to what to do. Just make sure your calculations are unstored.

It fails to mention the elimination of the seconds, but you can figure that out easily enough.

Jerry, to make it easy for you (and others) I have posted a demo on the Sample Files forum.

Yeah, it's cool.

Yes, the parameter "format" is valuable - when it works. Regrettably, it seems to not work in all situations.

In the example which I posted in Sample Files (FMPro 5.0v.3) the code [fmp-field:d_today,format] (which in my haste I did mis-identify on the browser page as d_today00) displays the date on the browser as 9/6/2003, yet the date field in the db file is formatted to display the date as September 6, 2003. Similarly the code [fmp-field:d_now,format] displays the time as 13:31:21 on the browser page yet the time field in the db file is formatted to display 1:31 PM.

Jerry's query included,

I would love to see something more like:

Record created Febuary 21, 2003 at 2:12 AM

According to the demonstration which I posted the parameter "format" does not address Jerry's issue. Unstored calculations do.

I would suggest that by using calculation fields, formatting for American or European dates is relatively simple and straightforward. From the same date field, two calcs could allow the display of both date formats on the same browser page. Wow, talk about international appeal for your site. Can you do that with the parameter "format" on a date field? I think not.

Using:

[FMP-Field:mydate, Format] at [FMP-Field:mytime, Format]

works for me. It gives:

September 7, 2003 at 08:00 AM

I've formatted the fields "mydate" and "mytime" how I wanted them on the Layout and this is the way they are displayed on the browser page.

Good Luck.

Garry

p.s. I should have given credit to Anatoli for the discovery of this un-documented feature.

p.p.s I am using FM 6.0v4

re: p.p.s I am using FM 6.0v4

Thanks for the info. I guess that represents one of the new features of 6 which is not in 5.0. Many would be very frustrated with the results of using "format" as it is recommended above (not version specific). They might not otherwise be aware of the solution which I presented. I hope it save a few some frustration.

RE: p.s. I should have given credit to Anatoli for the discovery of this un-documented feature.

I didn't discover that; I only posted it here first smile.gif

It shows the amazing usefulness of this forum!

Because for many of us the CDML Reference database is "the holy book", what is not in CDML RD is ignored or not know at all.

While working in LA, I was modifying some old CDML code, not very optimized, sometimes like "spagethi code in BASIC". The programmer, BTW from Mexico, who authored that code was excellent, but CDML was probably not his/hers strongest skill.

And there it was, sitting in code and for that purpose worked brilliantly. FORMAT! Before that I was always forced to use calculation field in FM.

So in next topic started by "cinolas" I've posted that gem smile.gif

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.