Jump to content

Recommended Posts

Posted

Hello there,

I'm a real novice in the scripting language.

Does somebody know how to calculate with the date?

I'm daily creating reports from Monday thru Friday. The contents of the reports is from the day before and on Monday it will be from last Friday.

Now I'm running into a problem. When the 1st of the month falls on a week day, the last day of the previous month will be 00 instead for example 31.

Could anyone help me out?

The script I'm using is:

#include <Date.au3>

$curdate = _NowCalcDate()

;remove "/" from the date format
$curdate = StringReplace ( $curdate, "/", "" )

;declaration
$prevdate = $curdate - 1

MsgBox (0,"test", $prevdate&" "&$curdate)

Many thanks!

Posted

#include <Date.au3>

$sNewDate = _DateAdd( 'd', -1, _NowCalcDate())
MsgBox( 4096, "", "Today - 1 day:" & $sNewDate )
Hi Zedna,

It works, thanks!

I cracked my brains but no results.

Again, thanks for taking time to check my issue!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...