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.

Specify date format in XSL

Featured Replies

  • Newbies

I use server7 advanced with custom web pages.

In my databases I use the date format "yyyy-mm-dd", but on my web pages the date is viewed as "mm/dd/yyyy". How can i specify that the date format on the web pages should be "yyyy-mm-dd"?

/Henrik

  • 3 weeks later...
  • Newbies

This has also completely defeated me, did you ever find an answer?

You can use the fmxslt:convert_datetime(String oldFormat, String newFormat, String

  • 5 weeks later...
  • Newbies

The FileMaker Site Assistant generated a recordlist.xsl file that dug out the date in my datafile like this

td align="left">

<xsl:for-each select="fmrs:field[@name='c_Created_date']/fmrs:data">

<xsl:if test="position() != 1"><br/></xsl:if>

<xsl:value-of select="."/>

<xsl:if test=". = ''">

<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>

</xsl:if>

</xsl:for-each>

</td>

This returns date in the format "mm/dd/yyyy"

Any ideas to make that "dd-mm-yyyy"?

The line

<xsl:value-of select="."/> must be changed to

<xsl:value-of select="fmxslt:convert_datetime('MM/dd/yyyy','dd-MM-yyyy',.)"/>

Martin

  • Newbies

Thank you Martin for excellent advice!

  • 3 months later...

This works great for displaying a date in the appropriate format but what happens when you wish to convert the date format on the form when finding a record.

The problem I have is that the form I use to search the database uses the format MM/dd/yyyy but the subsequent display pages (which use the extension function above) display the date in dd/MM/yyyy. How do I convert the date in the form to the format dd/MM/yyyy?

This is done normally client-side, e.g. with JavaScript. I don't have a handy example, but you might search on Google with the search terms javascript date validation or javascript date form .

See also this thread .

Cheers for that.

Anybody know why the wpe formats the date into MM/dd/yyyy? Wouldn't it be better if it just passed the data through without formatting it? That way you could manipulate it how you wanted it within the actual database itself and have that reflected on your pages without having to go to all this extra effort.

No, it's much better like it is now than in the "good old" CMDL days, where date formats seldom worked as they should (depending on the language of FMS and FMU). Think of a multilingual country (as the one where I come from). You need only one date in the DB, but depending on the language of your web pages, you can now adjust the date format as you like. Also for certain web services you need special date formats, e.g. W3CDTF for Dublin Core metadata.

What I'm missing is a function with which one could subtract dates from each other. The fmxslt:compare_date(date1,date2) function just yields 1,0,-1 depending on if date1 is after, at the same date as, or before date2. It could also yield the difference in days ...

smile.gif I'll take your word for it. I guess I'm just bit peeved as the regional date format in my country is dd/MM/yyyy and just about every piece of software I touch does things in the american format. For obvious reasons I'll admit but it gets frustrating after a while.

Anyway I continued my problem in the other thread you directed me too. So if you feel inclined I'd appreciate any further help.

Cheers.

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.