Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7898111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:20:44+00:00 2026-06-03T08:20:44+00:00

I am using a FileDownload control to show a list of attachments from a

  • 0

I am using a FileDownload control to show a list of attachments from a Notes document.

The dates are shown as: dd/MM/yy hh.mm – and since my users are Danish I would like to show the dates in the format: dd-MM-yyyy hh:mm.

That is pretty simple if you use a SimpleDateFormater. In SSJS that would look like:

var date:Date = new Date(aFile.getCreated());
if(date==null) return date;
return new java.text.SimpleDateFormat("dd-MM-yy hh:mm").format(date);

In the FileDownload control you can compute the value of “createdValue” property. However, the control expects an object of type “Date” which does not allow for the formating in the above example (it just throws an Error 500).

Any suggestions?

/John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:20:46+00:00Added an answer on June 3, 2026 at 8:20 am

    You already found that the createdValue property expects a java.util.Date object, so the only way to change how that is formatted is by changing the browser locale used by the XPage (as answered here). Using the standard download control you can get a handle on every file by adding the var=”file” attribute to it and use that in the createdValue property:

    createdValue="new Date(file.getCreated());"
    

    If you want to have more control on the list of files you could use a repeat control and bind it to the list of files from a RichText item:

    <xp:repeat id="repeat1" rows="30" var="file" disableOutputTag="true">
        <xp:this.value><![CDATA[#{javascript:document1.getAttachmentList("files")}]]></xp:this.value>
        <xp:this.facets>
            <xp:text escape="false" disableTheme="true" xp:key="header">
                <xp:this.value><![CDATA[<table><tbody>]]>
                </xp:this.value></xp:text>
            <xp:text escape="false" disableTheme="true" xp:key="footer"><xp:this.value><![CDATA[</tbody></table>]]></xp:this.value></xp:text>
        </xp:this.facets>
        <tr>
            <td>
                <xp:text escape="true" id="computedField1" value="#{file.name}"></xp:text>
            </td>
            <td>
                <xp:text escape="true" id="computedField2">
                    <xp:this.value><![CDATA[#{javascript:var date:Date = new Date(file.getCreated());
        return new java.text.SimpleDateFormat("dd-MM-yy hh:mm").format(date);}]]></xp:this.value>
          </xp:text>
        </td>
      </tr>
    </xp:repeat>
    

    By the way: another a disadvantage of the default download control is that it adds a content-disposition header to every link, so the browsers always asks you if you want to save or open the file instead of opening images (for instance) directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement an Asynchronous file download from a web server using
I'd like to be able to invoke a file download from rails using link
i am downloading tiff images from WAMP server using our Flex AIR client. Using
I am trying to download a file from dropbox using the RESTful API. When
I am using python urllib2 to download pages from the web. I am not
I just moved my Wordpress site from using nginx to Apache2, and found that
I am using this code: <p:commandLink id=downloadLink value=Download ajax=false> <p:fileDownload value=#{supplierFileController.fileroute()} /> </p:commandLink> Works
Do you have any idea how can I use xp:fileDownload control in a xp:repeat
I'm using Primefaces fileDownload. When I first start the application the file is downloaded
using java code in windows i need to download several files from a directory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.