Jump to content
Sign in to follow this  
niubbone

Date format with _DateAdd

Recommended Posts

niubbone

I wrote this script to add a little standalone calendar in a game I'm making.

this is the code:

DayAfter("2010/12/20")
#include <Date.au3>
Func DayAfter($Data)
Local $NewDate = $Data
    $NewDate = _DateAdd('d', 1, $NewDate)
    MsgBox(4096, "", "Today + 1 days:" & StringRight($NewDate,2) & '/' & StringMid($NewDate,6,2) & '/' & StringLeft($NewDate,4))
EndFunc

Basically, whenever I want a day to pass, I'll call Dayafter($Data).

I would like the date to be as set in the msgbox (DD/MM/YYYY) and not like the function wants it (YYYY/MM/DD). Also I would like to know how if it's possible to make the game say the day it is, not only the number.

Example: Monday 21 january, tuesday 22 january and so on. I've already the solution of this (I thought of making a $array[7] with days name and make it cycle. Just wondering if there is any native function to do this, so code will be more elegant and smooth.

Thanks

Share this post


Link to post
Share on other sites
exodius

Have you looked at_DateToDayOfWeek?

Share this post


Link to post
Share on other sites
niubbone

Have you looked at_DateToDayOfWeek?

Yep nice, I looked at that commands before but you made an error and so do I.

We both looked at _DateToDayOfWeek. I thought that was useless for me, then I saw in the example script _DateDayOfWeek (To is absent here). I think thats what you were meaning to say. Thanks.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.