gcue Posted August 6, 2009 Share Posted August 6, 2009 hello. i am trying to get yesterdays date with this: MsgBox(0,"",_DateTimeFormat(_DateAdd("D",-1,_NowCalcDate()),0)) but i am trying to preserve the zeros when either the month or day are single digit... ie: 01/04/2009 instead of 1/4/2009 any ideas? thanks! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 6, 2009 Share Posted August 6, 2009 Maybe replace _NowCalcDate with @YEAR & "/" & @MON & "/" & @MDAYSee Macros - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 6, 2009 Share Posted August 6, 2009 Notice that most return values are two-digits long.From the 'Time and Date Macros' section of the AutoIt help file - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
picaxe Posted August 6, 2009 Share Posted August 6, 2009 but i am trying to preserve the zeros when either the month or day are single digit... ie: 01/04/2009 instead of 1/4/2009Change your pc's regional short date to "dd/MM/yyyy" or use ConsoleWrite(StringRegExpReplace(_DateAdd("D",-1,_NowCalcDate()), '(\d+)/(\d+)/(\d+)', '$3/$2/$1') & @LF)instead of _DateTimeFormat Link to comment Share on other sites More sharing options...
gcue Posted August 6, 2009 Author Share Posted August 6, 2009 perfect! thanks!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now