Hi Stefano,
While I have no practical experience with European dates, I did play around with this a bit.
I found it odd that the "e" and "u" options were put in the "outsep" section.
It almost makes me think that these are not true options, but the ICONV command seems to accept them. Strange.
I could not get input conversion to work with the "e" option but was able to get both input and output conversion to work using the SET-DATE-STD and SET-DATE-EUR commands.
In my examples I use the "(L" option so that only my PIB is affected.
Hope this helps...
Lance
Heading = @( 10 ) : 'Internal' : @( 20 ) : 'External' : @( 35 ) : 'Internal(Conv)'
CRT @( -1 ) : 'Current SET-DATE setting is US format' ; CRT
Today = DATE()
TodayOut = Today'D4/'
TodayIn = TodayOut'DI'
CRT Heading
CRT 'Today:' :@( 10 ): Today : @(20) : TodayOut : @(35) : TodayIn
CRT
CRT "EXECUTE 'SET-DATE-EUR (L' command"
CRT 'Current SET-DATE setting is European format' ; CRT
EXECUTE 'SET-DATE-EUR (L'
Today = DATE()
TodayOut = Today'D4/'
TodayIn = TodayOut'DI'
CRT Heading
CRT 'Today:' :@( 10 ): Today : @(20) : TodayOut : @(35) : TodayIn
CRT
CRT "EXECUTE 'SET-DATE-STD (L' command"
CRT 'Current SET-DATE setting is US format' ; CRT
EXECUTE 'SET-DATE-STD (L'
Today = DATE()
TodayOut = Today'D4/'
TodayIn = TodayOut'DI'
CRT Heading
CRT 'Today:' :@( 10 ): Today : @(20) : TodayOut : @(35) : TodayIn
CRT
CRT
Output:
Current SET-DATE setting is US format
Internal External Internal(Conv)
Today: 20011 10/14/2022 20011
EXECUTE 'SET-DATE-EUR (L' command
Current SET-DATE setting is European format
Internal External Internal(Conv)
Today: 20011 14/10/2022 20011
EXECUTE 'SET-DATE-STD (L' command
Current SET-DATE setting is US format
Internal External Internal(Conv)
Today: 20011 10/14/2022 20011
------------------------------
Lance Mcmillin
Sr Programmer Analyst
Health Advocates
Sherman Oaks CA US
------------------------------
Original Message:
Sent: 10-13-2022 10:22
From: Alberto Leal
Subject: European Date format
you can do something like this
PROGRAM CONVERTDATE (DATE$CON)
DATE = FIELD(DATE$CON,"/",1)
MONTH = FIELD(DATE$CON,"/",2)
YEAR = FIELD(DATE$CON,"/",3)
DATE$CON = MONTH:"/"DATE:"/":YEAR
EXECUTE 'SET-DATE-STD'
DATE$CON = ICONV(DATE$CON,"D4/")
RETURN
-----------------------------------------------
DATE$E = "13/10/2022" ;* EUROPEAN DATE
DATA$AMERICAN = ICONV(DATE$,"CALL CONVERTDATE)
------------------------------
Alberto Leal
System Analyst
Millano Distribuidora de Auto Pecas Ltda
Varzea Grande MT BR
Original Message:
Sent: 10-13-2022 10:05
From: Alberto Leal
Subject: European Date format
Hy Stefano...
my first awnser as incomplete...
then i editid
alternative you can use
*My_Date = '30/09/2022'*crt My_Datecrt 'Now Eurpoean'EXECUTE 'set-date-eur' ;* Europeanb_date = '19997'crt b_datec = Oconv(b_date, 'D4/')crt ccrt 'next 'd = Iconv(c, 'D4/')crt dcrt 'Now American'EXECUTE 'set-date-std' ;* Americanb_date = '19997'crt b_datec = Oconv(b_date, 'D4/')crt ccrt 'next 'd = Iconv(c, 'D4/')crt dcrt ' and Done!'
------------------------------
Alberto Leal
System Analyst
Millano Distribuidora de Auto Pecas Ltda
Varzea Grande MT BR
Original Message:
Sent: 10-13-2022 09:58
From: Stefano Gallotta
Subject: European Date format
Hi Alberto,
Yes thanks, aware of the set-date-eur line in coldstart.
I was just (disturbed) that the ICONV would not return a valid date when I JUST OCONV the (valid) date.
Brian explained why and all's good thanks :)
It's just something a developer needs to be made aware of when (and if) you receive an Excel spreadsheet with a date (assume here 'dd/mm/yyyy') and good practice is to ICONV said date.
This is how I came about this "issue" - no set-date-eur in coldstart - date looks good until you ICONV and OCONV it back with 'D4/E' - and surprise surprise it's NULL
[Per my test example:]
But thanks :)
b_date = '19997'
crt b_date
c = Oconv(b_date, 'D4/E')
crt c
crt 'next '
d = Iconv(c, 'D4/E')
crt d
crt ' and Done!'
------------------------------
Stefano Gallotta
Managing Member
Simply Red Open Systems
Milnerton ZA
Original Message:
Sent: 10-13-2022 09:25
From: Alberto Leal
Subject: European Date format
Hy i use the statement
SET-DATE-EUR
in my logon macro of the account.. so all my dates are convert to this format and also inside programs
*My_Date = '30/09/2022'*crt My_Datecrt 'Now Eurpoean'EXECUTE 'set-date-eur' ;* Europeanb_date = '19997'crt b_datec = Oconv(b_date, 'D4/')crt ccrt 'next 'd = Iconv(c, 'D4/')crt dcrt 'Now American'EXECUTE 'set-date-std' ;* Americanb_date = '19997'crt b_datec = Oconv(b_date, 'D4/')crt ccrt 'next 'd = Iconv(c, 'D4/')crt dcrt ' and Done!'
https://www3.rocketsoftware.com/rocketd3/support/documentation/d3nt/102/refman/TCL/set_date_eur_command.htm#reference5811
------------------------------
Alberto Leal
System Analyst
Millano Distribuidora de Auto Pecas Ltda
Varzea Grande MT BR
Original Message:
Sent: 10-13-2022 08:16
From: Stefano Gallotta
Subject: European Date format
Hi Alex
No, the first thing I checked :)
------------------------------
Stefano Gallotta
Managing Member
Simply Red Open Systems
Milnerton ZA
Original Message:
Sent: 10-13-2022 07:37
From: Alex Polglaze
Subject: European Date format
Is it case sensitive by any chance? You use the "e" in the statement but your code has "E".
------------------------------
Alex Polglaze
The Book-Keeping Network
Perth Western Australia
+61419 776 348
apolglaze@book-keepingnetwork.com.au
https://www.book-keepingnetwork.com.au/
Original Message:
Sent: 10-12-2022 07:50
From: Stefano Gallotta
Subject: European Date format
Hi all
I reside in the UK and for our "sins" we still honor the European data format of DD/MM/YYYY.
There is a conversion code which 'e' which according to the D3 manual states:
e | Uses european date format regardless of current system default setting |
This is great, however, I discovered something rather disturbing and am wondering whether anyone (this side of the Atlantic) can see (a) if I'm doing something wrong OR (b) has uncovered this.
BTW - I am aware of the set-date-eur option in a coldstart - which (in my case) I have not opted to have.
See this code:
*My_Date = '30/09/2022'
*crt My_Date
b_date = '19997'
crt b_date
c = Oconv(b_date, 'D4/E')
crt c
crt 'next '
d = Iconv(c, 'D4/E')
crt d
crt ' and Done!'
The results are as follows:
19997
30/09/2022
next
and Done!
Which is "disturbing" as the Iconv resolves to a NULL date!
Any ideas (please)
Thanks
Stefano
------------------------------
Stefano Gallotta
Managing Member
Simply Red Open Systems
Milnerton ZA
------------------------------