Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Decrement a date
Topic Summary:
Created On: 10/13/2009 01:10 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 10/13/2009 01:10 AM
User is offline View Users Profile Print this message

Author Icon
KK
Student (5-19 posts)

Posts: 10
Joined: 09/01/2009

Is there a simple way to have dates decremented by one? I already have the day decremented, but as you can imagine there are some problems with this (such as when the day is the 1st, does it decrement to '31' or '30'?).



 Category Survey
 10/13/2009 01:14 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

KK,
%Date-20% is always 20 days before to-day
%Date-1% is always yesterday, even on the 1st of the month.

 Category Survey


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 10/13/2009 01:25 AM
User is offline View Users Profile Print this message

Author Icon
KK
Student (5-19 posts)

Posts: 10
Joined: 09/01/2009

The problem is that I need the date formatted in a certain way, I can't simply call out the date and have it decremented. When I try your method of decrementing the date on my custom date, it doesn't work.



 Category Survey


Edited: 10/13/2009 at 01:34 AM by KK
 10/13/2009 04:34 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Where do you get the date from ? How is it formated ? Could you post a sample ?
In case your date is a standard date according to your own computer locales,
%CDate(yourdate)-1% could do it

 Category Survey


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 10/13/2009 04:52 AM
User is offline View Users Profile Print this message

Author Icon
ErikHedlund
Expert (100-199)

Posts: 152
Joined: 12/08/2008

You can always use the Format function to display a date in the format you'd prefere.

Example:
%Format(Date-1,"YYYY-MM-DD")%



 Category Survey


-------------------------
Erik Hedlund
Senior systemarchitect
A-team member
+4793028609

 10/14/2009 11:40 AM
User is offline View Users Profile Print this message

Author Icon
Dustin Snell
AUTOMATE EMPLOYEE

Posts: 1656
Joined: 03/30/2005

While simply subtracting a number from the date works. The proper way is to use the DateAdd function.

 Category Survey


-------------------------
Dustin Snell
 11/02/2011 05:02 PM
User is offline View Users Profile Print this message

Author Icon
AaronRichins
Student (5-19 posts)

Posts: 17
Joined: 04/08/2008

Can you use variables within the dateadd function? Automate does not seem to like it, I get errors. For example, if I wanted to increment the date of a variable, or if the amount to be incremented is a variable. I tried to accomplish this by using the Automate "set variable" commnd, and set it to %DateAdd("d", 1, %TodayDate%)

 Category Survey
 11/03/2011 06:29 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Aaron,

There are many ways to decrement the date:

 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1581 guests browsing this forum, which makes a total of 1581 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog