| View previous topic :: View next topic |
| Author |
Message |
sgeva2001
Joined: 04 Oct 2005 Posts: 32
|
Posted: Thu Oct 06, 2005 9:19 am Post subject: date cmd |
|
|
I 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 |
|
 |
BoBo Guest
|
Posted: Thu Oct 06, 2005 10:20 am Post subject: |
|
|
| A_Now |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
|
| Back to top |
|
 |
Nemroth
Joined: 07 Sep 2004 Posts: 262 Location: France
|
Posted: Thu Oct 06, 2005 5:29 pm Post subject: |
|
|
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 |
|
 |
sgeva2001
Joined: 04 Oct 2005 Posts: 32
|
Posted: Thu Oct 06, 2005 6:47 pm Post subject: |
|
|
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 |
|
 |
BoBo Guest
|
Posted: Thu Oct 06, 2005 7:14 pm Post subject: |
|
|
| 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
|
Posted: Thu Oct 06, 2005 8:29 pm Post subject: How to use it? |
|
|
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 |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Thu Oct 06, 2005 8:50 pm Post subject: Re: How to use it? |
|
|
| sgeva2001 wrote: | | I try "my_var = A_NOW" | Do: my_var = %A_Now% (see here). |
|
| Back to top |
|
 |
Nemroth
Joined: 07 Sep 2004 Posts: 262 Location: France
|
Posted: Thu Oct 06, 2005 10:12 pm Post subject: |
|
|
try : | Code: | FormatTime, TheDate,, ShortDate
msgbox %TheDate% |
|
|
| Back to top |
|
 |
sgeva2001
Joined: 04 Oct 2005 Posts: 32
|
Posted: Fri Oct 07, 2005 9:05 am Post subject: The correct way for me |
|
|
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 |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1035 Location: switzerland
|
Posted: Fri Oct 07, 2005 11:48 am Post subject: |
|
|
| Code: | H:=A_NOW
msgbox,%H%
|
|
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Fri Oct 07, 2005 12:26 pm Post subject: |
|
|
| 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
|
Posted: Fri Oct 07, 2005 4:45 pm Post subject: VERY STARNGE |
|
|
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 |
|
 |
BoBo Guest
|
Posted: Fri Oct 07, 2005 4:54 pm Post subject: |
|
|
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
|
Posted: Fri Oct 07, 2005 5:02 pm Post subject: |
|
|
a) DD/MM/YYYY _________________ thanks
WIN XP PRO |
|
| Back to top |
|
 |
|