Jump to content

Need Helps About Date Code !!!!


Go to solution Solved by BrewManNH,

Recommended Posts

$ngay = @Mday
If $msg = 6 Then $ngay = @MDAY + 1
     Sleep(50)
     Send("{DEL 2}")
     Sleep(50)
     Send($ngay)
EndIf
 
Here is my issue, my date code just plus 1 when i choose tomorrow. 
 
For exp : Now is 31March so tomorrow is 1April, but in my case, the code will be like 32March. 
 
So what i have to do now ??? Need your helps !!!! 
Link to comment
Share on other sites

Maybe use one of these functions to work out your issue --  _DayValueToDate or _DateAdd


 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I found out an issue like the position of Day , Month, Year is not compatible with my country system. 

_NowCalcDate will show YEAR/MONTH/DATE

But what i need is DATE/MONTH/YEAR. 

So What i have to do ???? Plz help me !!!

Edited by sdynk02
Link to comment
Share on other sites

  • Solution

You need to convert the date from _NowCalcDate to DD/MM/YYYY. The easiest way to do it would be to use stringsplit, using "/" as the delimiter, then put the date back together in the format you want. Like this.

#include <Date.au3>
Global $aDate = StringSplit(_NowCalcDate(), "/")
Global $sDate = $aDate[3] & "/" & $aDate[2] & "/" & $aDate[1]
ConsoleWrite("Today's date = " & $sDate & @CRLF)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

_DateAdd, it's in the help file.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I don't know what you mean by you couldn't code it for tomorrow. That code outputs tomorrows date for me, what do you get in $sNewDate when you run that?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

$sDate = _DateAdd("D", 1, _NowCalcDate())
$sNewDate = StringRegExpReplace($sDate,"(d{4})/(d{2})/(d{2})","$3/$2/$1")
I used StringRegExpReplace to change the format to mm/dd/yyyy so now i got one more issue like change the format to DD/Month/Year 
 
For Example : 05April15(05Apr15) 
Link to comment
Share on other sites

Your requirements are all over the place, it's like trying to hit a tsetse fly with a shotgun. Each one of your requirements are basically the same, but you're making them more difficult as you go along. If you can change the layout of the format, using whatever code you want to do this, you can just as easily change what the date shows up as for each month. You already have the month's number, you just need to translate it into a string, and there's a dozen examples of how to do that floating around the forum.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Here a script to convert month numbers to month names.

$iMon = InputBox("Month", "Enter Month  (  1 - 12)", @MON)
If $iMon < 1 Or $iMon > 12 Then Exit MsgBox(16 + 262144, Default, "Wrong month input. Only 1 to 12 accepted.", 0)
$sLocalLongMon = DllCall('kernel32.dll', 'int', 'GetLocaleInfoW', 'ulong', 0, 'dword', 55 + $iMon, 'wstr', '', 'int', 2048)[3]
$sLocalShortMon = DllCall('kernel32.dll', 'int', 'GetLocaleInfoW', 'ulong', 0, 'dword', 67 + $iMon, 'wstr', '', 'int', 2048)[3]
$sUSLongMon = DllCall('kernel32.dll', 'int', 'GetLocaleInfoW', 'ulong', 1033, 'dword', 55 + $iMon, 'wstr', '', 'int', 2048)[3]
$sUSShortMon = DllCall('kernel32.dll', 'int', 'GetLocaleInfoW', 'ulong', 1033, 'dword', 67 + $iMon, 'wstr', '', 'int', 2048)[3]
MsgBox(262144, Default, "Local name: " & $sLocalLongMon & " / " & $sLocalShortMon & @LF & "US name: " & $sUSLongMon & " / " & $sUSShortMon, 0)

App: Au3toCmd              UDF: _SingleScript()                             

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...