Quantcast
Channel: Indigo Rose Software Forums - Forums
Viewing all articles
Browse latest Browse all 2105

Check out my script for displaying the Day - Date - Month - Year

$
0
0
On a project I wanted to display the date as below

Sunday 2nd May 2021

This is how I like to read the date, here in the UK.

I found an old thread and got the basics of how to get near what I wanted.

So I elaborated on the script and came up with this

Code:
-- Day Of The Week
DayName = {}
DayName[1]= "Sunday";
DayName[2]= "Monday";
DayName[3]= "Tuesday";
DayName[4]= "Wednesday";
DayName[5]= "Thursday";
DayName[6]= "Friday";
DayName[7]= "Saturday";
Result1 = String.ToNumber(System.GetDate(DATE_FMT_DAYOFWEEK) );
-- End Of - Day Of The Week

-- Day Of The Month
DayOfTheMonth = {}
DayOfTheMonth[1] = "1st"
DayOfTheMonth[2] = "2nd"
DayOfTheMonth[3] = "3rd"
DayOfTheMonth[4] = "4th"
DayOfTheMonth[5] = "5th"
DayOfTheMonth[6] = "6th"
DayOfTheMonth[7] = "7th"
DayOfTheMonth[8] = "8th"
DayOfTheMonth[9] = "9th"
DayOfTheMonth[10] = "10th"
DayOfTheMonth[11] = "11th"
DayOfTheMonth[12] = "12th"
DayOfTheMonth[13] = "13th"
DayOfTheMonth[14] = "14th"
DayOfTheMonth[15] = "15th"
DayOfTheMonth[16] = "16th"
DayOfTheMonth[17] = "17th"
DayOfTheMonth[18] = "18th"
DayOfTheMonth[19] = "19th"
DayOfTheMonth[20] = "20th"
DayOfTheMonth[21] = "21st"
DayOfTheMonth[22] = "22nd"
DayOfTheMonth[23] = "23rd"
DayOfTheMonth[24] = "245th"
DayOfTheMonth[25] = "25th"
DayOfTheMonth[26] = "26th"
DayOfTheMonth[27] = "27th"
DayOfTheMonth[28] = "28th"
DayOfTheMonth[29] = "29th"
DayOfTheMonth[30] = "30th"
DayOfTheMonth[31] = "31st"
Result2 = String.ToNumber(System.GetDate(DATE_FMT_DAY));
-- End Of - Day Of The Month

-- Month
MonthName = {}
MonthName[1]= "January";
MonthName[2]= "February";
MonthName[3]= "March";
MonthName[4]= "April";
MonthName[5]= "May";
MonthName[6]= "June";
MonthName[7]= "July";
MonthName[8]= "August";
MonthName[9]= "September";
MonthName[10]= "October";
MonthName[11]= "November";
MonthName[12]= "December";
Result3 = String.ToNumber(System.GetDate(DATE_FMT_MONTH));
-- End Of - Month

-- Year
Year = System.GetDate(DATE_FMT_YEAR);
-- End Of Year

-- Complete Output
--Paragraph.SetText("Paragraph1", DayName[Result1].." "..DayOfTheMonth[Result2].." "..MonthName[Result3].." "..Year);
Dialog.Message("Todays Date",DayName[Result1].." "..DayOfTheMonth[Result2].." "..MonthName[Result3].." "..Year, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
-- End Of - Complete Output
I was wondering what you pro's thought of it . Does it look ok or could it be made simpler ?

I have had lots and lots of help and not really given nowt back...

Somebody may find this useful.

I will test it out each day and see if I have things right..


Viewing all articles
Browse latest Browse all 2105

Trending Articles