Jump to content
Sign in to follow this  

changing date value

Recommended Posts


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, "/", "" )

$prevdate = $curdate - 1

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

Many thanks!

Share this post

Link to post
Share on other sites

#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!

Share this post

Link to post
Share on other sites

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
Sign in to follow this