Jump to content
  • 0
Parma2015

Formatting Date In Calendar Popup

Question

Hi!I have several calendar popups in my app, and I usually want to set the default date by receiving a parameter. In this case a timestamp.

I want to format the date as short date, but can't find out how to do it. I cant find other parameters than timestamp. Is there a way to receive system date, or to format the timestamp as short date?

As I am located in Norway, the format should be DD.MM.YYYY.

Jan H

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi Jan,

 

I think, you can add this code to the Footer (do not forget clicking the Source button and changing FIELDNAME to the name of your field):

<SCRIPT LANGUAGE="JavaScript">
     var myDate = new Date();
     myDate.setFullYear(myDate.getFullYear()+1);
     var myMonth = myDate.getMonth() + 1;
     if (myMonth<10) {myMonth = "0" + myMonth;}
     var myDay = myDate.getDate();
     if (myDay<10) {myDay = "0" + myDay;}
     var myYear = myDate.getFullYear();
     var result = myDay + "." + myMonth + "."  + myYear;
     document.getElementById("InsertRecordFIELDNAME").value=result;
</SCRIPT>

When a DataPage opens, the current date in the "dd.mm.yyyy" format is entered to the field.

 

I'll be grateful, if you tell me if the code works.

Have a nice day!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...