Jump to content

how to auto change date


Recommended Posts

  • Developers

Could U give me the code?

My code :

#include <Date.au3>


$sNewDate = _DateAdd( 'd',-5, _NowCalcDate())
_SetDate($sNewDate)

But it dont run exactly, So where's my error??

Have you looked at both fucntions in the Helpfile?

_Setdate() needs different input than returned by _DateAdd().

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Something like this should work:

#include <Date.au3>
$sNewDate = _DateAdd( 'd',-5, _NowCalcDate())
$aNewDate = StringSplit($sNewDate,"/")
If $aNewDate[0] = 3 Then
    _SetDate($aNewDate[3],$aNewDate[2],$aNewDate[1])
EndIf

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...