IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Page 1 of 2 1 2 >
Topic Options
#57637 - 08/27/20 12:23 PM Covert date to french
Luc Offline
OL Toddler

Registered: 02/26/15
Posts: 37
Loc: Montreal
Hi,
How can I convert my system date Thursday, August 27, 2020 to french: 27 Août 2020. ?

Thanks

Top
#57638 - 08/27/20 12:30 PM Re: Covert date to french [Re: Luc]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 681
Loc: Québec, Canada
Since the Date() function in PressTalk will use the language of the Regional system where the form is executed, you would need to do it via a script in Workflow prior to executing your form.
Then pass the formatted date as a variable or jobinfo to the form.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57639 - 08/27/20 12:33 PM Re: Covert date to french [Re: Luc]
Luc Offline
OL Toddler

Registered: 02/26/15
Posts: 37
Loc: Montreal
Can it be done in desing without workflow?

thanks

Top
#57640 - 08/27/20 01:15 PM Re: Covert date to french [Re: Luc]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 681
Loc: Québec, Canada
Yes but that would require a PressTalk that takes your date and convert it to its french counterpart. Since there is no such function, you would have to build it from scratch.

Now you say "...without workflow...". If the date is already in the data, then yes. But know that the Date() function cannot work in a printer as there is no system date.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57641 - 08/27/20 01:39 PM Re: Covert date to french [Re: Luc]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 50
There is a provided set of functions in our presstalk libraries that will do precisely that in Design, without workflow, in French.

Let me know if you cannot find them or I will try to provide as many details as possible

Top
#57642 - 08/27/20 01:40 PM Re: Covert date to french [Re: Luc]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 50

Top
#57643 - 08/27/20 01:42 PM Re: Covert date to french [Re: Luc]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 50
you will want to import in your document the following functions:
- Normalize date
- GetDayNameF
- GetMonthNameF
- FormatDateF

Top
#57644 - 08/27/20 01:45 PM Re: Covert date to french [Re: Luc]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 50
Another way to do this, since you already have the fully spelled days and months in english, would be to build arrays of days and months, in french and english, and find the position of the current english day and month from your data, and pull the value from the corresponding position in the french array to display on the form. A bit of work but not too complex.

Top
#57645 - 08/27/20 01:46 PM Re: Covert date to french [Re: Luc]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 681
Loc: Québec, Canada
Ah!...good to know...thanks @jouberto
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57646 - 08/27/20 02:49 PM Re: Covert date to french [Re: jouberto]
Luc Offline
OL Toddler

Registered: 02/26/15
Posts: 37
Loc: Montreal
Thanks

I now have the functions But I don't know how to use them

Would you have a code sample I could look into
I just want to write the date of the day on a letter in english or french depending on language

thanks

Top
#57647 - 08/27/20 03:29 PM Re: Covert date to french [Re: Luc]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 50
Hi Luc,

I will try to upload screenshots showing the right order to place the functions in the list and a syntax example to use them. These functions require you pass as a parameter the date format. As J-C mentioned at the top of the thread, the Date() function I use in my call for today's date, will have a format based on regional settings. Mine are set to YYYY-MM-DD, but yours could be different, just match what you have when writing the call to the function.

Top
#57648 - 08/27/20 03:42 PM Re: Covert date to french [Re: Luc]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 50
Putting these lines in a custom data selection will produce the desired dates in English and French. I couldn't find an online repository so I can link my screenshots to you, so I can only give you the below tips.

Code:
=@FormatDate(Date(false),'YYYY-MM-DD')

Code:
=@FormatDateF(Date(false),'YYYY-MM-DD')


The order for the functions should be:
-NormalizeDate
-GetDayName
-GetMonthName
-GetDayNameF
-GetMonthNameF
-FormatDate
-FormatDateF
Open each one starting from the top, and simply click ok, so they are "loaded" properly, otherwise you might get errors trying to call them.

Top
Page 1 of 2 1 2 >