Can someone please help me or point me in the right direction?
The getDay() method returns the day of the week (from 0 to 6) for the specified date.
Note: Sunday is 0, Monday is 1, and so on.
Use the included PDF practice file for your script which does just what you're looking for:
Thank you for your advice and video links.
I'm still having difficulty finding a script that will know if the date selected is a weekday or weekend and auto populate another field with a specific rate i.e. £65 Weekday, £130 Weekend.
Bernd provided the correct answer, but the first thing the script needs to do is to convert the text date entry into a Date Object. How this is done depends on the format. But lets just assume for this example that it's simple.
This script was designed to go into the Custom validate script of the date field.
var oMyDate = util.scand("mm/dd/yyyy", event.value);
var nDayOfWeek = oMyDate.getDay();
if((nDayOfWeek == 0) || (nDayOfWeek == 6))
this.getField("Rate").value = 130;
this.getField("Rate").value = 65;
this.getField("Rate").value = 0;