Here's an example that returns DD/MM/YY - I'm calling it from the click of a commandbutton in a canvas section. My function is just in the section custom library here.
Code:
function formatDate(d) {
var dd = d.getDate();
if ( dd < 10 ) dd = '0' + dd;
var mm = d.getMonth()+1;
if ( mm < 10 ) mm = '0' + mm;
var yy = d.getFullYear() % 100;
if ( yy < 10 ) yy = '0' + yy;
return dd+'/'+mm+'/'+yy;
}
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
function page1_section1_field1_click()
{
var currentdate = new Date();
messagebox(formatDate(currentdate));
}
Lianja dates start at 1/1/1900.
The TTOC() function is used to format datetimes.
I have enhanced it in v1.3Beta6 to handle ISO 8601. See below.
All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
Bookmarks