Hi,
How can I add suffix to the data fields i.e. st, th, rd nd.
I have a requirement where I need to add the following text "1st Day of Jan 2014" or "23rd Day of Jan 2015".
I was able to format it as "1 Day of Jan 2014" using pattern as "date{J 'DAY OF' MMM YYYY}".
Any thoughts?
Hi,
with the default date patterns you won't be able to create such date strings, but in combination with FormCalc it's of course possible.
I created an example that does what you've described.
It uses a Formcacl script in the date fields exit event to determine the needed suffix (st, nd, rd or th) and stuffs this into a new date pattern.
if (not $.isNull) then
var input = Date2Num($.editValue, "MM/DD/YYYY")
var day = Num2Date(input, "D")
var d
if (day lt 4) then
d = day
elseif (day ge 4 and day lt 20) then
d = 4
else
var m = Mod(day, 10)
if (m lt 4) then
d = m
else
d = 4
endif
endif
var suffix = Choose(d, "st", "nd", "rd", "th")
var pattern = Concat("D", "'", suffix, " Day of '", "MMM YYYY")
;var output = Num2Date(input, pattern)
$.format.picture.value = pattern
endif
Views
Replies
Total Likes
Hi,
I'm needing a script to achieve the same as Ajay Yada. I Pasted this into the script editor and everything works execpt the suffix is not coming in. Any suggestions.
thanks,
Views
Replies
Total Likes
Hey, Thanks for your reply. Sorry, I wasn't logging in much to the forums due to some critical deliverable at work. I will try your script as the document that needs the above requirement has been pushed back for some time now. I will keep you posted.
Views
Replies
Total Likes
Hello,
This script works on every day expect for 20th and 30th. I was able to get the 20th to work by changing this line:
elseif (day ge 4 and day lt 20) then
to
elseif (day ge 4 and day lt 21) then
but I can't seem to figure out how to get 30th to work...any ideas?
BTW, to those who cannot get the suffix to show make sure you insert a DATE field not a DATE/TIME Field and set the Edit pattern to: MM/DD/YYYY
Views
Replies
Total Likes
Hi,
Try changing the line (line 12);
if (m lt 4) then
to
if (Within(m, 1, 3)) then
Then you can change the 21 back to 20.
Hi I am trying to do this with Flash CS5,I pasted in that code,CS5 don't understand it,a load of errors come up, I need the date like this in a text box, "Saturday 10th August 2019"
I have made the code to print out "Saturday 10 August 2019" but missing the Suffix next to the date...?
Here is my code...
function getToday(){
var weekday_array:Array = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var today = new Date();
var number = today.getDate();
var weekday:String = weekday_array[today.getDay()];
var temp = weekday + " ";
temp += number;
return temp;
}
function getMonthz() {
var month_array:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var calendar = new Date();
var month:String = month_array[calendar.getMonth()];
var temp = month + " ";
return temp;
}
function getYearz(){
var yearz = new Date();
var number = yearz.getFullYear();
var temp = number;
return temp;
}
fullDate.text = getToday() + " " + getMonthz() + getYearz();
gotoAndPlay(1);
stop();
Views
Replies
Total Likes
The script above is written in FormCalc not ActionScript. You better ask you question in the ActionScript 1 and 2 forums.
Views
Replies
Total Likes
This is great very sought after. In my case; how would this apply if the field in question was the current day? In other words; a field within a paragraph which contains a field and therein displays only the current day along with the suffix? Similar to what one would display prior to a signature field. Signed this _______ day of [and i have the rest of the dates done already].
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies