Skip to content

Can you specify the format of lastmodifieddate

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
  • dhuesman Offline
  • Posts: 10
  • Joined: Mon Nov 24, 2014 8:27 am

Can you specify the format of lastmodifieddate

Post 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...
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Can you specify the format of lastmodifieddate

Post 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 all

Executing 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)'
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • dhuesman Offline
  • Posts: 10
  • Joined: Mon Nov 24, 2014 8:27 am

Re: Can you specify the format of lastmodifieddate

Post by dhuesman »

Worked great Rick ~ Thank You.
Post Reply