Jump to content

Australian dates


Recommended Posts

Massive australian problem!!!! Please help


- I am in Australia and our date format is dd/mm/yyyy so in excel 12 Jan 1975 = 12/1/1975 BUT in the US the date appears as 1/12/1975 - 12 months older

- The code below uses a default date format of mm/dd/yyyy (I assume)

- The outcome is the age produced is incorrect in 4% of files


Is there a way the date from the "birthday" column can be formatted dd/mm/yyyy to create the correct outcome. Any help would be greatly appreciated:


RULE - Select BACK PAGE ONLY based on Date of Birth


// OnRecordStart

Date.prototype.YearsBetween = function(){

var intMilYear = 365.23 * 24 * 60 * 60 * 1000;

var intMilDif = arguments[0] - this;

var intYears = Math.floor(intMilDif/intMilYear);

return intYears;



// YOUR FIELD in a standard date format

var dob = new Date(Field("birthday"));

var today = new Date();

var yearsBetween = dob.YearsBetween(today);


// Turn on age related backs for specific record (Pages named A,B,C,D and set to Unused)

if (yearsBetween <=16) FusionPro.Composition.SetBodyPageUsage("A",true);

else if (yearsBetween <= 40) FusionPro.Composition.SetBodyPageUsage("B",true);

else if (yearsBetween <= 60) FusionPro.Composition.SetBodyPageUsage("C",true);

else FusionPro.Composition.SetBodyPageUsage("D",true);

Link to comment
Share on other sites

I'm not sure the default JS Date() function is designed to handle the date in the dd/mm/yyyy format, but you could (fairly easily) alter your birthday data in the code prior to passing it into the custom function by altering the value of "dob" assuming your data file passes the date exactly as formatted above:

var tempDate = Field("birthday").split("/");
var dob = new Date(tempDate[2], tempDate[1], tempDate[0]);

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...