Subtract one day from date
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts
Page 1 of 1
I am looking for a way to subtract one day from a date that is not the current date. The TimeStamp task works great for subtracting days from the current date but it does not appear to be able to subtract days from any other date. My ultimate goal is to get the last modified date of a file and subtract one day from it.
Thanks,
Drew
Thanks,
Drew
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
DGlaser
Here's an easy way to make this a "utility" project and call it when you need to from other projects:
Otherwise, calculate the Milliseconds of the FROMDATE and Subtract 86400000*NoDays from it. Then, re-format your timestamp to display as needed.
Here's an easy way to make this a "utility" project and call it when you need to from other projects:
Code: Select all
You can use MSSQL or MySQL or DB2, etc ... pretty much any DB that you can connect to.<project name="Subtract NoDays From FromDate" mainModule="Main" version="2.0" logLevel="silent">
<variable name="FromDate" value="2015-06-01" />
<variable name="NoDays" value="2" />
<variable name="DateLessNoDays" value="" />
<module name="Main">
<sql label="Connect to MSSQL" resourceId="MSSQL Local" version="1.0">
<query label="Select Date Value" outputVariable="NewDate">
<statement>SELECT DATEADD(day, -${NoDays}, '${FromDate} 00:00:00.000')</statement>
</query>
</sql>
<setVariable label="SetVar: DateLessNoDays" name="DateLessNoDays" value="${NewDate[1]}" version="1.0" />
<print label="(Status) Show Date" version="1.0">
<![CDATA[
=============================
DateLessNoDays: ${DateLessNoDays}
=============================]]>
</print>
</module>
</project>
Otherwise, calculate the Milliseconds of the FROMDATE and Subtract 86400000*NoDays from it. Then, re-format your timestamp to display as needed.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts
Page 1 of 1