AnsweredAssumed Answered

How to convert to Date format in Gel script

Question asked by JayaSantoshKumar on Jan 7, 2016
Latest reply on Jan 7, 2016 by JayaSantoshKumar

Hello Everyone, I'm reading a file which has dates is dd/mm/yyyy Format now I'm trying it to convert them to  yyyy-mm-dd Format
I'm new to Gel and couldn't track my code where it is going wrong .

I'm able to read from file and Write to File , but unable to convert to yyyy-mm-dd Format
Could you please help me out


Here is my Code







<core:new className="java.util.Date" var="date"/>


<!-- Reading File from Provided Path -->

<gel:parameter default="D:\Gel Script Docs\JS Custom Scripts\Dates Task\dates.txt" var="infile"/>

<file:readFile fileName="${infile}" var="infileParsed" embedded="false"/>           



<!-- Writing to File in yyyy-mm--dd Format -->




        fileName="D:\Gel Script Docs\JS Custom Scripts\ReadWriteResult.txt">


          <core:forEach items="${infileParsed.rows}" var="row" indexVar="i" begin="0" step="1">



            <gel:formatDate format="yyyy-MM-dd" stringVar="mydate" dateVar="row[0]"/>

                                <file:column value="${mydate[0]}" />





<!-- Writing to File is closed here -->


<!-- FORMAT DATE -->

<gel:formatDate format="yyyy-MM-dd" stringVar="today" dateVar="date"/>

<gel:out> <gel:formatDate format="yyyy-MM-dd"  dateVar="date"/></gel:out>


today Date== ${today}






Error in Command Prompt is : Non-Date variable used as Date.