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: Date functions not working as expected
Topic Summary:
Created On: 01/16/2013 03:38 PM
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.
 01/16/2013 03:38 PM
User is offline View Users Profile Print this message

Author Icon
BrianPearson
Expert (100-199)

Posts: 149
Joined: 04/08/2005

The oddest thing lately ... we've been having a TON of trouble using date functions with the change over to 2013 ... though I suspect the issue is more with the 1st month of the year.

Many of our reports use Now()-1 and on the 1st day of the year, everything broke for us that does that.

Now I'm having a problem with this function Month(Now())-1 ... it's returning 0 instead of returning last month 12.

Is this a bug, or are we doing it wrong?

 Category Survey
 01/16/2013 03:47 PM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi Brian,

I recommend using the DateAdd() function instead:

%format(DateAdd("m", -1, Date), "mm")%

The above function will return 12.



 Category Survey
AutoMate BPA Server 8 version:
Windows version:


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

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 01/16/2013 09:53 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Brian,
Month() returns in the range 1 to 12 , therefore in January Month()-1 returns normally 0
While Now() is a serial number of all days, and Now-1 is always the previous day
The correct way of achieving what you need is shown in Leonard's reply.

 Category Survey
AutoMate BPA Server 8 version:
Windows version:


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

Author Icon
BrianPearson
Expert (100-199)

Posts: 149
Joined: 04/08/2005

awesome, thanks for the advice!

 Category Survey
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 1907 guests browsing this forum, which makes a total of 1907 users using this forum.

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

Sitemap Network Automation Software Blog