Jump to content

Convert variable (tomorrow) date to MM/DD/YYYY format


Recommended Posts

I have established how to get tomorrows date however I can't seem to figure out how to format the date into my required format of MM/DD/YYYY.  

I have this:

$today=_DateToDayValue(@YEAR,@MON,@MDAY)
Dim $Y, $M, $D
$tomorrow=_DayValueToDate($today+1, $Y, $M, $D)

The _DateToDayValue seems to have a fixed format.  I've also tried a :

$vardate = _DateAdd( 'd',1, _NowCalcDate())

with a "StringSplit" and/or StringFormat but the _NowCalcDate seems to also be fixed to a YYYY/MM/DD format.

I'm sure I'm missing something simple but am at a loss.

Any help would be MUCH appreciated

 

 

Link to comment
Share on other sites

Hello. Try this.

 

#include <Date.au3>
Local $today=_DateToDayValue(@YEAR,@MON,@MDAY),$Y, $M, $D
Local $tomorrow=_DayValueToDate($today+1, $Y, $M, $D)
$tomorrow= StringFormat("%02i/%02i/%04i", $M,  $D,  $Y)
ConsoleWrite($tomorrow & @CRLF)

Saludos

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 11 months later...

@JDGamboaG

I see why you are confused but look at it like this

#include <Date.au3>
Local $today
Local $Y
Local $M
Local $D

$today = _DateToDayValue(@YEAR,@MON,@MDAY)

Local $tomorrow

$tomorrow = _DayValueToDate($today+1, $Y, $M, $D) ;< [Y, M, D] those are by reference

$tomorrow = StringFormat("%02i/%02i/%04i", $M,  $D,  $Y)

ConsoleWrite($tomorrow & @CRLF)

this is exactly the same thing posted by Danyfirex just spread out

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

×
×
  • Create New...