I have searched the forum and found numerous discussions but not one the gets me exactly what I need. I also have an online functions manual but I am still unable to get something to work. I have a view with a date of type MDYY. I need the day number from that field. Ex: July 13 , 2013 would yeild: 13.
I tried using EDIT and wrapping that in a SUBSTR function but got an incompatible type error.
Is there something simple?This message has been edited. Last edited by: <Kathryn Henning>,
WebFOCUS 8206.08 Windows, All Outputs
August 01, 2013, 10:47 AM
Lloyd
Is your feild a date/numeric field or a text string?
If its a text string, you would first need to make sure that it is always the same format, i.e the month should always be three characters for consistency and the day should always be two chars, and then a simple edit with a mask should get you the day component.
If its a date/numeric field, try using the built in date functions (i.e HEXTR)
Lloyd Prendergast Michael Kors (USA), Inc. Phone: 201-453-5076 Fax: 646-354-4776 Lloyd.Prendergast@Michaelkors.com
WebFOCUS 523 WebFOCUS 7.6 WebFOCUS 7.7
Windows Server 2005 Windows Server 2008
Iseries V5R3M0 Iseries V5R5M0 Iseries V6R1M0
August 01, 2013, 10:55 AM
RobertF
hovering over the field...Format: MDYY....was told its numeric...
WebFOCUS 8206.08 Windows, All Outputs
August 01, 2013, 11:56 AM
Doug
quote:
hovering over the field
Normally implies what the display format is. You need to know the actual format, found in the synonym or "?FF filename".
August 01, 2013, 12:13 PM
John W Price
Robert, A Date type of MDYY often indicates a "SmartDate" datatype field. You may extract individual components in this manner (SD_MDY2 is an MDY SmartDate field):
a) YR1 /YY = SD_MDY2;
b) MO1 /MONTH = SD_MDY2;
c) DA1 /DAY = SD_MDY2;
d) QT1 /Q = SD_MDY2;
e) WK1 /W = SD_MDY2;
This and more can be found in the "Dates Book" available at www.Aviter.com".This message has been edited. Last edited by: John W Price,
WebFOCUS 8.0.2, FOCUS since 1977 - John@Aviter.com PDF , Excel, FOCUS, Author of the Keysheets and Dates book. www.Aviter.com
August 01, 2013, 12:18 PM
RobertF
thanks.. I will try...
WebFOCUS 8206.08 Windows, All Outputs
August 01, 2013, 01:02 PM
Francis Mariani
Several ways to do this:
DEFINE FILE CAR
TEST_DATE/MDYY = '03232011';
END
TABLE FILE CAR
PRINT
TEST_DATE
COMPUTE TEST_MONTH_I/I2 = DPART(TEST_DATE,'MM', 'I2');
COMPUTE TEST_MONTH_A/A02 = EDIT(FPRINT(TEST_DATE,'MDYY','A10'),'99$');
BY COUNTRY
END
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
August 01, 2013, 01:15 PM
Doug
DATECVT?
August 01, 2013, 01:53 PM
RobertF
Thanks all, when we get our server back I'll give it a go....
WebFOCUS 8206.08 Windows, All Outputs
August 01, 2013, 05:54 PM
Waz
The simplest way is to DEFINE or COMPUTE a field with a format of D
TABLE FILE CAR
PRINT COMPUTE DATE_MDYY/MDYY = '07/31/2013' ;
COMPUTE DATE_DAY/D = DATE_MDYY ;
COMPUTE DAY_I2/I2 = DATE_DAY ;
COMPUTE DAY_A2/A2 = EDIT(DATE_DAY);
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
END
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
August 02, 2013, 10:08 AM
George Patton
Cripes, Waz ... Please don't tell me they use that idiotic MDYY format down under ....
I'm in the middle here, but, what's wrong with the MDYY format?
August 05, 2013, 05:34 PM
Waz
quote:
what's wrong with the MDYY format
Can O worms ......
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
August 06, 2013, 08:37 AM
jgelona
quote:
Originally posted by Waz:
quote:
what's wrong with the MDYY format
Can O worms ......
Except all of my users like dates displayed in mm/dd/yyyy format.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
August 06, 2013, 09:26 AM
Doug
quote:
all of my users like dates displayed in mm/dd/yyyy format
Store them as smart dates with usage format = mm/dd/yyyy. BTW: I like that format for display, not for storage or sorting. Fortunately, WebFOCUS has those two options in its Can O Worms.
August 06, 2013, 05:48 PM
Waz
quote:
all of my users like dates displayed in mm/dd/yyyy format
Well there you go, different "regions" like different formats.
In OZ its either YYYY/MM/DD or DD/MM/YYYY.
And other countries around the world its different again.
Thank be to the Smart Date gods.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
August 07, 2013, 04:55 PM
RobertF
Just wanted to thank you all...COMPUTE DATE_DAY/D = DATE_MDYY ; is working.
WebFOCUS 8206.08 Windows, All Outputs
August 07, 2013, 05:30 PM
Waz
Please edit your first post in this thread and add [SOLVED] to the title.