Long date in other language

Issues related to label design (working with databases, data processing, RFID encoding etc.) and printing (from NiceLabel Express, NiceLabel Pro, NiceForm and NicePrint)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
amimeu
Enthusiast
Posts: 19
Joined: Thu Apr 11, 2013 2:18 pm

Long date in other language

Post by amimeu » Mon Nov 18, 2019 9:25 am

Hi,
I need to put a date with long month format on label: DD.MMM.YYYY
The problem is that the date must be in English but NiceLabel installation is in other language. So the long month is printed in application's language.
How can I force to print long date in English regardless of the application language or operating system settings?

(I'am using NiceLabel 5).

teo.jurado
Enthusiast
Posts: 16
Joined: Mon Oct 07, 2013 12:49 pm

Re: Long date in other language

Post by teo.jurado » Mon Nov 18, 2019 9:31 am

You need to put one function in VBScript.

For example this is for name of month in english, 4 chars...

Code: Select all

'Make sure that a value is set for label variables (preview the label before you start writing your script).
'The result of the script must be saved in the 'Result'
'variable. Default script will return value "0"

dim a, b, currentLocale,original,MiFecha, miarrayd, miarraym, miarraya
currentLocale = GetLocale
miarraya=Mid(DUNTIL, 1,2)
miarraym=Mid(DUNTIL, 3,2)
miarrayd=Mid(DUNTIL, 5,2)
MiFecha = miarrayd&"/"&miarraym&"/"&miarraya
mifecha=formatdatetime(cdate(mifecha),2)
'msgbox( MIFECHA& " - " & duntil)
'mifecha = duntil
currentLocale = setlocale("en-gb")
a = UCASE (Day( MiFecha) & " " & mid(UCASE(MonthName(Month( MiFecha) ,FALSE )),1,4))
'msgbox(a)
original = setlocale(currentLocale)
Result =UCASE( a)

amimeu
Enthusiast
Posts: 19
Joined: Thu Apr 11, 2013 2:18 pm

Re: Long date in other language

Post by amimeu » Mon Nov 18, 2019 10:53 am

Hi teo.jurado
thank you for the answer. The script returns "CDate type mismatch error".

I am sure that I must adapt it to my own environment. However, I don't understand what DUNTIL is in the Mid () function?

teo.jurado
Enthusiast
Posts: 16
Joined: Mon Oct 07, 2013 12:49 pm

Re: Long date in other language

Post by teo.jurado » Mon Nov 18, 2019 11:15 am

'a' is not a date, is a string... this function returns a string with name of month in english, but you can use for change the format date...

otherwise, you can change the format of a date for printing in the text field... declare as date and change the format to the value that you need.

amimeu
Enthusiast
Posts: 19
Joined: Thu Apr 11, 2013 2:18 pm

Re: Long date in other language

Post by amimeu » Mon Nov 18, 2019 11:32 am

ok,
this works fine for me:

Code: Select all

currentLocale = setlocale("en-gb")
Result = Day(Now) & UCase(MonthName(Month(Now), True)) & Year(Now)

teo.jurado
Enthusiast
Posts: 16
Joined: Mon Oct 07, 2013 12:49 pm

Re: Long date in other language

Post by teo.jurado » Mon Nov 18, 2019 11:47 am

DUNTIL is a variable that i use from keyboard entry...

Kind redgards.

Post Reply