July 03, 2006, 02:29 PM
KellyTConvert Alphanumeric to a date time format
Hello,
How do I go about converting a alphanumeric date to a datetime format? Example: July 03 2006 1:27PM to 07/03/2006 13:27.
I tried using the HINPUT function but received this error back:
0 ERROR AT OR NEAR LINE 15 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: July
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT
Thanks in advance.
| In Focus since 1993. WebFOCUS 7.7.03 Win 2003 |
July 03, 2006, 04:12 PM
MikelExample:
-* "July 03 2006 1:27PM" string to 07/03/2006 13:27 date/time
DEFINE FILE CAR
DATEA/A20 = 'July 03 2006 1:27PM' ;
DATEH/HDMYYS = HINPUT(20, DATEA, 8, 'HDMYYS');
END
TABLE FILE CAR
PRINT DATEA DATEH COUNTRY NOPRINT
END
Doc. Ref.:
HINPUT: Converting an Alphanumeric String to a TimestampDate and Time Components For Date and Date-Time FunctionsRegards,
Mikel
WebFOCUS 8.1.05, 8.2.01
July 06, 2006, 09:57 AM
KellyTDate1/A20='OrigRDD';
Date2/HYYMDS=HINPUT(14,'OrigRDD', 20, 'HYYMDS');
Date3/MDYY=HDATE(Date2,'MDYY');
Here is the code that I'm using. The problem is that when I open the report in developers studio these fields are not there for me to insert into the report. I manually go into the text view of the report and type Date1 in and then run the report but no data comes back. What comes back for Date1 is text saying OrigRDD.
Besides converting the date I also need to concatenate OrigRDD and OrigDD2 together so it would look like OrigDD - OrigDD2.
What am I doing wrong?
Thanks in advance.
Prod: WebFOCUS 8.2.0.4
OS: Windows
Outputs: HTML, PDF, Excel, PPT
In Focus since 2005
July 06, 2006, 10:10 AM
PrarieIn Date1 take the ' ' off. It is reading that as a test field OrigRDD.
| In Focus since 1993. WebFOCUS 7.7.03 Win 2003 |
July 06, 2006, 10:39 AM
KellyTIf I take the quotes off then I get this error message:
(FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: DATE1
Prod: WebFOCUS 8.2.0.4
OS: Windows
Outputs: HTML, PDF, Excel, PPT
In Focus since 2005
July 06, 2006, 01:55 PM
KameshTry this,
TABLE FILE TEST
PRINT
OrigRDD AS 'ORIGRDD'
ON TABLE HOLD AS TEST1
ON TABLE SET ASNAMES ON
END
-RUN
DEFINE FILE TEST1
DATE1/A20=ORIGRDD;
DATE2/HYYMDS=HINPUT(14,DATE1, 20, 'HYYMDS');
DATE3/MDYY=HDATE(DATE2,'MDYY');
END
TABLE FILE TEST1
PRINT ORIGRDD DATE1 DATE2 DATE3
END
-EXIT
WFConsultant
WF 8105M on Win7/Tomcat