Page 1 of 1
Can you specify the format of lastmodifieddate
Posted: Wed Dec 03, 2014 1:19 pm
by dhuesman
I'd like to format the last modified date to a Julian date (default is *ISO). I know with the current date you can specify the format "yyDDD" or perhaps "yyyyDDD" but I'm wanting to compare that to the lastmodifieddate attribute from a file. Any suggestions would be appreciated.
NOTE: I cannot connect to an iSeries to do this date math with SQL...
Re: Can you specify the format of lastmodifieddate
Posted: Mon Dec 08, 2014 9:03 am
by Support_Rick
Dan,
Try this formatting and see if it works for you...
Code: Select all<project name="Read LastModifiedDate" mainModule="Main" version="2.0">
<module name="Main">
<createFileList label="Read File List" fileListVariable="MyFileList" version="1.0">
<fileset dir="C:\Temp" />
</createFileList>
<forEachLoop label="Loop through Files" itemsVariable="${MyFileList}" currentItemVariable="ThisFile">
<setVariable label="SetVar: yyyy" name="yyyy" value="${ Substring( ThisFile:lastModifiedDate, 1, 4 ) }" version="2.0" />
<setVariable label="SetVar: mm" name="mm" value="${ Substring( ThisFile:lastModifiedDate, 6, 2 ) }" version="2.0" />
<setVariable label="SetVar: dd" name="dd" value="${ Substring( ThisFile:lastModifiedDate, 9, 2 ) }" version="2.0" />
<timestamp version="1.0">
<format outputVariable="JulDate" pattern="yyDDD" dayOfMonth="${dd}" month="${mm}" year="${yyyy}" />
</timestamp>
<print label="(Status) Print File Info" version="1.0">
<![CDATA[
====================================
File Name: ${ThisFile:name}
File Date: ${ThisFIle:lastModifiedDate}
yyyy: ${yyyy}
mm: ${mm}
dd: ${dd}
JulDate: ${JulDate}
====================================]]>
</print>
</forEachLoop>
</module>
</project>
Joblog should look like this...
Code: Select allExecuting task 'print 1.0 ((Status) Print File Info)'
====================================
File Name: 1.jpg
File Date: 2013-01-14 09:22:15.184
yyyy: 2013
mm: 01
dd: 14
JulDate: 13014
====================================
Finished task 'print 1.0 ((Status) Print File Info)'
Executing task 'print 1.0 ((Status) Print File Info)'
====================================
File Name: 11.jpg
File Date: 2013-05-20 09:05:03.477
yyyy: 2013
mm: 05
dd: 20
JulDate: 13140
====================================
Finished task 'print 1.0 ((Status) Print File Info)'
Re: Can you specify the format of lastmodifieddate
Posted: Tue Dec 09, 2014 8:37 am
by dhuesman
Worked great Rick ~ Thank You.