dateLiteralEnFr ( theDate ; language ; dayOption ; yearOption )
Given a date and and a language -
Average rating: 4.4 (31 votes) Log in to vote
François Goulet Lizzy Logik Inc. Not applicable |
dateLiteralEnFr( "2014-07-25"; "FR" ; 2 ; "") >
VENDREDI, 25 juillet 2014
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
DateLiteralEnFr(language; dateField; dayOption; yearOption) v.1
DateLiteralEnFr(language; dateField; dayOption; yearOption) v.2 (Changes made to: 1 argument name and order + examples; variables presentation) - Thank you Teg!
Given a date and a language ("EN" for English" or "FR" for French), the CF returns the literal date in the chosen language.
- Options for "dayOption" are: ""; "1"; "2"; "3"; "4"
- Options for "yearOption" are: ""; "1"
EX:
DateLiteralEnFr( "2014-07-25" ; "EN"; ""; "") > July 25 2014
DateLiteralEnFr( "2014-07-25" ; "FR"; ""; "") > 26 juillet 2014
DateLiteralEnFr( "2014-07-25" ; "EN"; 1; "") > Friday, July 25 2014
DateLiteralEnFr( "2014-07-25" ; "FR"; 1; "") > Vendredi, 25 juillet 2014
DateLiteralEnFr( "2014-07-25" ; "EN"; 2; "") > FRIDAY, July 25 2014
DateLiteralEnFr( "2014-07-25" ; "FR"; 2; "") > VENDREDI, 25 juillet 2014
DateLiteralEnFr( "2014-07-25" ; "EN"; 3; "") > Friday (BOLD), July 25 2014
DateLiteralEnFr( "2014-07-25" ; "FR"; 3; "") > Vendredi (BOLD), 25 juillet 2014
DateLiteralEnFr( "2014-07-25" ; "EN"; 4; "") > FRIDAY (BOLD), July 25 2014
DateLiteralEnFr( "2014-07-25" ; "FR"; 4; "") > VENDREDI (BOLD), 25 juillet 2014
DateLiteralEnFr( "2014-07-25" ; "EN"; ""; "1") > July 25
DateLiteralEnFr( "2014-07-25" ; "FR"; ""; "1") > 25 juillet
Comments
eos, Teg Dec 12, 2014 |
||
Nice idea, but can be executed less convoluted; also, the argument order in your example is incorrect … Try /* LiteralDate_EN_FR ( theDate ; language ; dayOption ; yearOption ) */ Let ( [ dt = theDate ; y = Year ( dt ) ; m = Month ( dt ); d = Day ( dt ) ; dow = DayOfWeek ( dt ) ; mn = Case ( language = "EN" ; List ( "January" ; "February" ; "March" ; "April" ; "May" ; "June" ; "July" ; "August" ; "September" ; "October" ; "November" ; "December" ) ; List ( "janvier" ; "février" ; "Mars" ; "avril" ; "mai" ; "juin" ; "juillet" ; "août" ; "septembre" ; "octobre" ; "novembre" ; "décembre" ) ) ; dn = Case ( language = "EN" ; List ( "Sunday" ; "Monday" ; "Tuesday" ; "Wednesday" ; "Thursday" ; "Friday" ; "Saturday" ) ; List ( "Dimanche" ; "Lundi" ; "Mardi" ; "Mercredi" ; "Jeudi" ; "Vendredi" ; "Samedi" ) ) ; do = Max ( 0 ; dayOption ) ; yDisplay = Case ( IsEmpty ( yearOption ) ; " " & y ) ; dn = GetValue ( dn ; dow ) ; mnD = GetValue ( mn ; m ) ; mnYD = ", " & mnD & " " & d & yDisplay ] ; Choose ( do ; mnD & yDisplay ; dn & mnYD ; TextStyleAdd ( dn ; Uppercase ) & mnYD ; TextStyleAdd ( dn ; Bold ) & mnYD ; TextStyleAdd ( dn ; Uppercase + Bold ) & |
||
François Goulet, Montreal, QC Canada Dec 12, 2014 |
||
Thanks so much for your observations and suggestions Teg. I've already integrated some of those in v.2 of my CF (and fixed the incorrect example) as you can see. I'm leaving the calc part of the CF as is for now but will certainly run some tests using you suggested CF which is indeed less convoluted. Thanks Again, François |
||
Bernard Moreau, Borchtlombeek - Belgium Dec 13, 2014 |
||
Thanks Teg for improving. Small correction needed : "Mars" in the French months list must be written without capital : "mars". |
||
François Goulet, Montreal, QC Canada Dec 13, 2014 |
||
OUPS! Correction made... Merci et bonne journée Bernard. |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.