Page 1 of 1

Date

Posted: 15 Dec 2015 14:12
by Atbl
Hi,
I wad trying to display the date of previous day and I am successful also. But the problem is that I want to show like this:-
1st
2nd
3rd
4th
5th
:
:
:
31st
After 1, it should show 'st'
After 2, it should show 'nd'
And so on......
In every date it is only showing only 'th'.
Please Help!!

http://automagic4android.com/flow.php?i ... c5dc2030d6

Re: Date

Posted: 16 Dec 2015 20:16
by Martin
Hi,

There needs to be a slight modification in your script:
today = getDate();
today = addDays(today, -1);
daym = "{today,dateformat,d}";
if(daym == '1'){
finalDate = "{today,dateformat, '1st' MMMM yyyy}";
}else if(daym == '2'){
finalDate = "{today,dateformat, '2nd' MMMM yyyy}";
}else if(daym == '3'){
finalDate = "{today,dateformat, '3rd' MMMM yyyy}";
}else{
finalDate = "{today,dateformat,  dd'th' MMMM yyyy}";
}
Mainly the formatting of daym seems to be wrong in the shared flow.
I just changed the formatting of daym to use one digit for the day and use the single number also in the if-checks.

Regards,
Martin