AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

date cmd
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
sgeva2001



Joined: 04 Oct 2005
Posts: 32

PostPosted: Thu Oct 06, 2005 9:19 am    Post subject: date cmd Reply with quote

QuestionI am looking for a command which will give the date in my computer to a variable and later I want to change the date.

thanks
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Oct 06, 2005 10:20 am    Post subject: Reply with quote

A_Now
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Oct 06, 2005 12:11 pm    Post subject: Reply with quote

To change the date or time, here are a couple of topics:
http://www.autohotkey.com/forum/viewtopic.php?t=3413
http://www.autohotkey.com/forum/viewtopic.php?t=2773

And here's a script by Garry to change the time:
Code:
InputBox,TIME,Send Time to DOS,HH:MM
if ErrorLevel <> 0
    ExitApp
Run %COMSPEC% /C time %TIME%,,hide
ExitApp
Back to top
View user's profile Send private message Send e-mail
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Thu Oct 06, 2005 5:29 pm    Post subject: Reply with quote

An a little but (I think, of course) util procedure and function : date util
You can see in it tue usage of the FormatTime command.
Back to top
View user's profile Send private message
sgeva2001



Joined: 04 Oct 2005
Posts: 32

PostPosted: Thu Oct 06, 2005 6:47 pm    Post subject: Reply with quote

Chris wrote:
To change the date or time, here are a couple of topics:
http://www.autohotkey.com/forum/viewtopic.php?t=3413
http://www.autohotkey.com/forum/viewtopic.php?t=2773

And here's a script by Garry to change the time:
Code:
InputBox,TIME,Send Time to DOS,HH:MM
if ErrorLevel <> 0
    ExitApp
Run %COMSPEC% /C time %TIME%,,hide
ExitApp


it is working very good , thanks.
I still need the cmd which assign the date to a varibale.
_________________
thanks

WIN XP PRO
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Oct 06, 2005 7:14 pm    Post subject: Reply with quote

Quote:
I still need the cmd which assign the date to a varibale
Two options:
a) you don't read the help
b) you don't read the answers/posts to your request

A_Now (already posted Thu Oct 06, 2005 10:20 am)
Back to top
sgeva2001



Joined: 04 Oct 2005
Posts: 32

PostPosted: Thu Oct 06, 2005 8:29 pm    Post subject: How to use it? Reply with quote

I fail using the A_NOW.
I try "my_var = A_NOW"
"Run %COMSPEC% /C date %my_var%,,hide "
but it is not working .
Where is my mistake?
_________________
thanks

WIN XP PRO
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Thu Oct 06, 2005 8:50 pm    Post subject: Re: How to use it? Reply with quote

sgeva2001 wrote:
I try "my_var = A_NOW"
Do: my_var = %A_Now% (see here).
Back to top
View user's profile Send private message Visit poster's website
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Thu Oct 06, 2005 10:12 pm    Post subject: Reply with quote

try :
Code:
FormatTime, TheDate,, ShortDate
msgbox %TheDate%
Back to top
View user's profile Send private message
sgeva2001



Joined: 04 Oct 2005
Posts: 32

PostPosted: Fri Oct 07, 2005 9:05 am    Post subject: The correct way for me Reply with quote

I tried "my_var = %A-NOW% but it did not work.
I tried "FormatTime, my_var,, ShortDate " and it is working!!!
_________________
thanks

WIN XP PRO
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1035
Location: switzerland

PostPosted: Fri Oct 07, 2005 11:48 am    Post subject: Reply with quote

Code:
H:=A_NOW
msgbox,%H%
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Oct 07, 2005 12:26 pm    Post subject: Reply with quote

Code:
I fail using the A_NOW.
I try "my_var = A_NOW"
"Run %COMSPEC% /C date %my_var%,,hide "
but it is not working
Of course.
Two errors:

a)
wrong: my_var = A_NOW
correct: my_var = %A_NOW%
also correct: my_var := A_NOW
b)
DOS's date command expects an date input which is different to the datestamp format which is delivered via AHK's A_Now var. Check the help for further details.

AHK's FormatTime does exactly what's expected, it takes AHK's date format and converts/shrinks it the way you need it.

RTFM.
Back to top
sgeva2001



Joined: 04 Oct 2005
Posts: 32

PostPosted: Fri Oct 07, 2005 4:45 pm    Post subject: VERY STARNGE Reply with quote

I run this simple script:
"FormatTime, TheDate,, ShortDate
Run %COMSPEC% /C date %TheDate%,,hide "

What happen is that every time I activate it , it cause excahnge of day and month:
first run : the result is that the date in the computer became 10/07/2005
second run:the result is that the date became 07/10/2005
third time: the result is that the date became 10/07/2005
and so on..
what is the problem? why it does not keep the same date?
_________________
thanks

WIN XP PRO
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Oct 07, 2005 4:54 pm    Post subject: Reply with quote

What are your OS's default regional settings regarding date/time?
a) DD/MM/YYYY
b) MM/DD/YYYY
Back to top
sgeva2001



Joined: 04 Oct 2005
Posts: 32

PostPosted: Fri Oct 07, 2005 5:02 pm    Post subject: Reply with quote

a) DD/MM/YYYY
_________________
thanks

WIN XP PRO
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group