dersiniar Posted June 29, 2022 Share Posted June 29, 2022 Hello I have a date in $string. ( 29 April ) How i can use addition on it. Example 5+$string cant be done. I used split do separate date and month and if i use addition on it i get result 34 April.. lol. How i can make addition right I have a multiple dates and i need to add days. i use Guictrlcreateinput for adding extra days example from my script guictrlcreateinput("4",280,55, 30,20) Link to comment Share on other sites More sharing options...
Subz Posted June 29, 2022 Share Posted June 29, 2022 Convert the date into YYYY/MM/DD and then use _DateAdd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 29, 2022 Moderators Share Posted June 29, 2022 dersiniar, And my DateTimeConvert UDF (look in my sig for the link) will help with the conversion. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Subz Posted June 29, 2022 Share Posted June 29, 2022 Basic example, using Melba23 Date_Time_Convert UDF expandcollapse popup#include <Array.au3> #include <Date.au3> #include <DTC.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> Local $sDates = "July 3" & @CRLF & _ "July 7" & @CRLF & _ "July 5 - January 9th *" & @CRLF & _ "July 2 - 4" & @CRLF & _ "July 20 - August 16" & @CRLF & _ "July 5 - 9" & @CRLF & _ "July 4 - May 30" & @CRLF & _ "July 6 - 12" & @CRLF & _ "July 5 - 8" & @CRLF & _ "July 6 - 14" & @CRLF & _ "July 20 - September 16**" & @CRLF & _ "July 6 - 12" Local $aDates = StringRegExp($sDates, "(?:.*-\s)([A-Za-z]*\s[0-9]*)", 3) _ArrayColInsert($aDates, 1) For $i = 0 To UBound($aDates) - 1 $aDates[$i][1] = _Date_Time_Convert($aDates[$i][0] & " " & @YEAR, "MMMM d yyyy", "yyyy/MM/dd") Next GUICreate("Date Add", 220, 90) Local $sNewDate Local $idDates = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($idDates, _ArrayToString($aDates, "|", -1, -1, "|", 0, 0), $aDates[0][0]) Local $idDays = GUICtrlCreateInput("4", 10, 35, 200, 20) Local $idNewDate = GUICtrlCreateInput("", 10, 60, 200, 20) GUISetState() _AddDays() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idDates _AddDays() EndSwitch WEnd Func _AddDays() Local $sNewDate = _DateAdd("D", GUICtrlRead($idDays), $aDates[_GUICtrlComboBox_GetCurSel($idDates)][1]) If Not @error Then GUICtrlSetData($idNewDate, _Date_Time_Convert($sNewDate, "yyyy/MM/dd", "MMMM d")) EndIf EndFunc Link to comment Share on other sites More sharing options...
dersiniar Posted June 30, 2022 Author Share Posted June 30, 2022 (edited) 18 hours ago, Subz said: Basic example, using Melba23 Date_Time_Convert UDF expandcollapse popup#include <Array.au3> #include <Date.au3> #include <DTC.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> Local $sDates = "July 3" & @CRLF & _ "July 7" & @CRLF & _ "July 5 - January 9th *" & @CRLF & _ "July 2 - 4" & @CRLF & _ "July 20 - August 16" & @CRLF & _ "July 5 - 9" & @CRLF & _ "July 4 - May 30" & @CRLF & _ "July 6 - 12" & @CRLF & _ "July 5 - 8" & @CRLF & _ "July 6 - 14" & @CRLF & _ "July 20 - September 16**" & @CRLF & _ "July 6 - 12" Local $aDates = StringRegExp($sDates, "(?:.*-\s)([A-Za-z]*\s[0-9]*)", 3) _ArrayColInsert($aDates, 1) For $i = 0 To UBound($aDates) - 1 $aDates[$i][1] = _Date_Time_Convert($aDates[$i][0] & " " & @YEAR, "MMMM d yyyy", "yyyy/MM/dd") Next GUICreate("Date Add", 220, 90) Local $sNewDate Local $idDates = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($idDates, _ArrayToString($aDates, "|", -1, -1, "|", 0, 0), $aDates[0][0]) Local $idDays = GUICtrlCreateInput("4", 10, 35, 200, 20) Local $idNewDate = GUICtrlCreateInput("", 10, 60, 200, 20) GUISetState() _AddDays() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idDates _AddDays() EndSwitch WEnd Func _AddDays() Local $sNewDate = _DateAdd("D", GUICtrlRead($idDays), $aDates[_GUICtrlComboBox_GetCurSel($idDates)][1]) If Not @error Then GUICtrlSetData($idNewDate, _Date_Time_Convert($sNewDate, "yyyy/MM/dd", "MMMM d")) EndIf EndFunc I tested it out, its what i need, but i haven't been able to get it into my script. Can you help me to modify for my need? Local $sDates = $sDate ;----- this is string with date ( 5.juuli ) Local $aDates = StringRegExp($sDates, "(?:.*-\s)([A-Za-z]*\s[0-9]*)", 3) _ArrayColInsert($aDates, 1) For $i = 0 To UBound($aDates) - 1 $aDates[$i][1] = _Date_Time_Convert($aDates[$i][0] & " " & @YEAR, "MMMM d yyyy", "yyyy/MM/dd");-------I dont need time and year. only day and month Next _AddDays() Func _AddDays() Local $sNewDate = _DateAdd("D", GUICtrlRead($Tarneddinbut), $sDate);------GUICtrlRead($Tarneddinbut)---is what i use to add days to $aDates If Not @error Then $sDates = $idNewDate, _Date_Time_Convert($sNewDate, "MM/dd") Else $sDates = "Not found" EndIf Local $UpDate = $sDates ;----This is final result i need for outbut EndFunc Edited June 30, 2022 by dersiniar Link to comment Share on other sites More sharing options...
Subz Posted June 30, 2022 Share Posted June 30, 2022 Are your dates in english? are they also in the format :month day i.e. January 9 or another format? Link to comment Share on other sites More sharing options...
dersiniar Posted June 30, 2022 Author Share Posted June 30, 2022 14 minutes ago, Subz said: Are your dates in english? are they also in the format :month day i.e. January 9 or another format? Local $sDates = $sDate ;----- this is string with date ( 5.juuli ) 5.juuli its estonian, 5.July Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 30, 2022 Moderators Share Posted June 30, 2022 dersiniar, Then you will need to let my UDF know about the month names in Estonian. Look in the UDF example script for the _Date_Time_Convert_Set section to see how to use it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dersiniar Posted June 30, 2022 Author Share Posted June 30, 2022 1 hour ago, Melba23 said: dersiniar, Then you will need to let my UDF know about the month names in Estonian. Look in the UDF example script for the _Date_Time_Convert_Set section to see how to use it. M23 I made dates into English. Output i get is "July 5" there have to be added extra 4 days onto but its not. so its not doing anything right now Func Dates() Global $sDates = $UpDate ;----- this is string with date ( July 5 ) ConsoleWrite($sDates) Local $aDates = StringRegExp($sDates, "(?:.*-\s)([A-Za-z]*\s[0-9]*)", 2) _ArrayColInsert($aDates, 1) For $i = 0 To UBound($aDates) - 1 $aDates[$i][1] = _Date_Time_Convert($aDates[$i][0] & " " & "MMMM d", "mm/dd");-------I dont need time and year. only day and month Next _AddDays() EndFunc Func _AddDays() Local $sNewDate = _DateAdd("D", GUICtrlRead($Tarneddinbut), $sDates);------GUICtrlRead($Tarneddinbut)---is what i use to add days to $aDates If Not @error Then $sDates = $idNewDate, _Date_Time_Convert($sNewDate, "mm/dd") Else $sDates = "Not found" EndIf Local $deliveryDate = $sDates ;----This is final result i need for outbut EndFunc Link to comment Share on other sites More sharing options...
Subz Posted June 30, 2022 Share Posted June 30, 2022 Please post the entire script along with the gui, similar to the script I posted above. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 30, 2022 Moderators Share Posted June 30, 2022 dersiniar, You have only 1 space in the "July 5" string, but 2 spaces in the "MMMM d" string for the UDF. In this case the UDF will fail as the in mask does not match the input. And your out mask is asking for minutes ("mm") and not padded digital month ("MM"). This works for me: #include <MsgBoxConstants.au3> #include "DTC.au3" Global $sIn_Date, $sOut_Date $sIn_Date = "July 5" $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM d", "MM/d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Musashi Posted June 30, 2022 Share Posted June 30, 2022 8 hours ago, dersiniar said: Local $sDates = $sDate ;----- this is string with date ( 5.juuli ) 5.juuli its estonian, 5.July 8 hours ago, Melba23 said: Then you will need to let my UDF know about the month names in Estonian. Look in the UDF example script for the _Date_Time_Convert_Set section to see how to use it. I am using this UDF from Melba23 for the first time, but certainly not for the last. @dersiniar : To use the Estonian month names you have to proceed like this ( as Melba23 already wrote) : expandcollapse popup#cs For information purposes only : Calendar in Estonian Months : jaanuar (January) veebruar (February) märts (March) aprill (April) mai (May) juuni (June) juuli (July) august (August) september (September) oktoober (October) november (November) detsember (December) Days of the Week : esmaspäev (Monday) teisipäev (Tuesday) kolmapäev (Wednesday) neljapäev (Thursday) reede (Friday) laupäev (Saturday) pühapäev (Sunday) #ce #include <MsgBoxConstants.au3> #include "DTC.au3" Global $sIn_Date, $sOut_Date ; Input month strings : changed to Estonian _Date_Time_Convert_Set("LMI", "jaanuar,veebruar,märts,aprill,mai,juuni,juuli,august,september,oktoober,november,detsember") ; Example 1 : $sIn_Date = "juuli 15" $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM d", "MM/d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion 1 :", $sIn_Date & @CRLF & $sOut_Date) ; Example 2 : $sIn_Date = "15.juuli" $sOut_Date = _Date_Time_Convert($sIn_Date, "d.MMMM", "MM/d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion 2 :", $sIn_Date & @CRLF & $sOut_Date) "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
dersiniar Posted July 1, 2022 Author Share Posted July 1, 2022 18 hours ago, Subz said: Please post the entire script along with the gui, similar to the script I posted above. Cant do that, i have like 2k lines and i don't want to make my script public Link to comment Share on other sites More sharing options...
dersiniar Posted July 1, 2022 Author Share Posted July 1, 2022 (edited) 19 hours ago, Melba23 said: dersiniar, You have only 1 space in the "July 5" string, but 2 spaces in the "MMMM d" string for the UDF. In this case the UDF will fail as the in mask does not match the input. And your out mask is asking for minutes ("mm") and not padded digital month ("MM"). This works for me: #include <MsgBoxConstants.au3> #include "DTC.au3" Global $sIn_Date, $sOut_Date $sIn_Date = "July 5" $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM d", "MM/d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) M23 Hmm this leaves everything same . July.7 is income and outgoing is same 7/7. I wanted to add from guictrlcreateinput extra days onto it Income from internet is July.7 I want to add extra 4 days onto it so it shold be July.11 Global $sIn_Date, $sOut_Date $Testdate= GUICtrlRead($TaEddInbut) ConsoleWrite($Testdate & @CRLF) ;Outbut 4 $TEstdateOut= _Date_Time_Convert($TaEddInbut, "MMMM d", "MM/d") ;Outbut - $sIn_Date = $sDates $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM d", "MM/d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date &@crlf&$TEstdateOut) And $sOut_Date = _DateAdd('d', $TEstdate, _NowCalcDate() does not seem to work. i got result 07/05 This is full script i test now to get it work Local $sDates = "July 7" ;----- this is string with date ( 5.juuli ) Local $aDates = StringRegExp($sDates, "(?:.*-\s)([A-Za-z]*\s[0-9]*)", 3) _ArrayColInsert($aDates, 1) $sOut_Date = _Date_Time_Convert($aDates, "MMMM d", "MM/d") ConsoleWrite($sDates&@CRLF) Local $sNewDate = _DateAdd("D", 4, $sDates);------GUICtrlRead($Tarneddinbut)---is what i use to add days to $aDates If Not @error Then $sDates = $idNewDate, _Date_Time_Convert($sNewDate, "MM/dd") Else $sDates = "Not found" EndIf Local $UpDate = $sDates ;----This is final result i need for outbut ConsoleWrite("ENNE: "&$sDates&" NÜÜD: "&$sDates) Result: 0 Edited July 1, 2022 by dersiniar Link to comment Share on other sites More sharing options...
Musashi Posted July 1, 2022 Share Posted July 1, 2022 1 hour ago, dersiniar said: This is full script i test now to get it work 1. This is far from being a runnable test script. 2. If you use _DateAdd, a year is required. Otherwise leap years will not be taken into account. For example, it makes a difference if you add four days to the date 2022/02/27 or to the date 2020/02/27. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
dersiniar Posted July 1, 2022 Author Share Posted July 1, 2022 (edited) 35 minutes ago, Musashi said: 1. This is far from being a runnable test script. 2. If you use _DateAdd, a year is required. Otherwise leap years will not be taken into account. For example, it makes a difference if you add four days to the date 2022/02/27 or to the date 2020/02/27. i do not need year x.x Lets say i use this #cs For information purposes only : Calendar in Estonian Months : jaanuar (January) veebruar (February) märts (March) aprill (April) mai (May) juuni (June) juuli (July) august (August) september (September) oktoober (October) november (November) detsember (December) Days of the Week : esmaspäev (Monday) teisipäev (Tuesday) kolmapäev (Wednesday) neljapäev (Thursday) reede (Friday) laupäev (Saturday) pühapäev (Sunday) #ce #include <MsgBoxConstants.au3> #include "DTC.au3" Global $sIn_Date, $sOut_Date ; Input month strings : changed to Estonian _Date_Time_Convert_Set("LMI", "jaanuar,veebruar,märts,aprill,mai,juuni,juuli,august,september,oktoober,november,detsember") ; Example 1 : $sIn_Date = "juuli 15" $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM d", "MM/d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion 1 :", $sIn_Date & @CRLF & $sOut_Date) How i can add days onto it? Example $ExtraDays = 4 Edited July 1, 2022 by dersiniar Link to comment Share on other sites More sharing options...
Solution Musashi Posted July 1, 2022 Solution Share Posted July 1, 2022 12 minutes ago, dersiniar said: i do not need year x.x Truly not ? February.27 + 4 days results in March.3 (but in a leap year it will be March.2) An example (quick and dirty) for demonstration purposes only : ; Income from internet is July.7 I want to add extra 4 days onto it so it should be July.11 #include <MsgBoxConstants.au3> #include <Date.au3> #include "DTC.au3" Global $sIn_Date, $sOut_Date, $sIn_DateYear, $sOut_DateFull, $sOut_DateCalc, $sOut_DateNew $sIn_DateYear = "2022" ; @YEAR for current year or make a manual year specification like "2020" $sIn_Date = "July.7 " $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM dd", "MM/d") $sOut_DateFull = $sIn_DateYear & "/" & $sOut_Date $sOut_DateCalc = _DateAdd("D", 4, $sOut_DateFull) $sOut_DateNew = _Date_Time_Convert($sOut_DateCalc, "YYYY MM dd", "MMMM.d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & _ $sOut_Date & @CRLF & _ $sOut_DateFull & @CRLF & _ $sOut_DateCalc & @CRLF & @CRLF & _ "Result = " & $sOut_DateNew & @CRLF) pixelsearch and dersiniar 2 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
dersiniar Posted July 1, 2022 Author Share Posted July 1, 2022 (edited) 29 minutes ago, Musashi said: Truly not ? February.27 + 4 days results in March.3 (but in a leap year it will be March.2) An example (quick and dirty) for demonstration purposes only : ; Income from internet is July.7 I want to add extra 4 days onto it so it should be July.11 #include <MsgBoxConstants.au3> #include <Date.au3> #include "DTC.au3" Global $sIn_Date, $sOut_Date, $sIn_DateYear, $sOut_DateFull, $sOut_DateCalc, $sOut_DateNew $sIn_DateYear = "2022" ; @YEAR for current year or make a manual year specification like "2020" $sIn_Date = "July.7 " $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM dd", "MM/d") $sOut_DateFull = $sIn_DateYear & "/" & $sOut_Date $sOut_DateCalc = _DateAdd("D", 4, $sOut_DateFull) $sOut_DateNew = _Date_Time_Convert($sOut_DateCalc, "YYYY MM dd", "MMMM.d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & _ $sOut_Date & @CRLF & _ $sOut_DateFull & @CRLF & _ $sOut_DateCalc & @CRLF & @CRLF & _ "Result = " & $sOut_DateNew & @CRLF) This is purrrrrrrfect ❤️ i managed to get it work in my script, thank you man a lot. Also didn't think about leap year omg Global $sDates = $dDate ;ConsoleWrite($sDates&@CRLF) Global $ExdraDays= GUICtrlRead($Tinbut) ;ConsoleWrite($ExdraDays&@CRLF) Global $sIn_Date, $sOut_Date, $sIn_DateYear, $sOut_DateFull, $sOut_DateCalc, $sOut_DateNew $sIn_DateYear = "2022" ; @YEAR for current year or make a manual year specification like "2020" $sIn_Date = $sDates $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM dd", "MM/d") $sOut_DateFull = $sIn_DateYear & "/" & $sOut_Date $sOut_DateCalc = _DateAdd("D", $ExdraDays, $sOut_DateFull) $sOut_DateNew = _Date_Time_Convert($sOut_DateCalc, "YYYY MM dd", "MMMM d") $NEWDate=$sOut_DateNew ;ConsoleWrite($NEWDate&@CRLF) Edited July 1, 2022 by dersiniar Link to comment Share on other sites More sharing options...
dersiniar Posted July 4, 2022 Author Share Posted July 4, 2022 (edited) On 7/1/2022 at 10:42 AM, Musashi said: Truly not ? February.27 + 4 days results in March.3 (but in a leap year it will be March.2) An example (quick and dirty) for demonstration purposes only : ; Income from internet is July.7 I want to add extra 4 days onto it so it should be July.11 #include <MsgBoxConstants.au3> #include <Date.au3> #include "DTC.au3" Global $sIn_Date, $sOut_Date, $sIn_DateYear, $sOut_DateFull, $sOut_DateCalc, $sOut_DateNew $sIn_DateYear = "2022" ; @YEAR for current year or make a manual year specification like "2020" $sIn_Date = "July.7 " $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM dd", "MM/d") $sOut_DateFull = $sIn_DateYear & "/" & $sOut_Date $sOut_DateCalc = _DateAdd("D", 4, $sOut_DateFull) $sOut_DateNew = _Date_Time_Convert($sOut_DateCalc, "YYYY MM dd", "MMMM.d") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & _ $sOut_Date & @CRLF & _ $sOut_DateFull & @CRLF & _ $sOut_DateCalc & @CRLF & @CRLF & _ "Result = " & $sOut_DateNew & @CRLF) I'm back, Looks like its not working after all as needed. $sDates=($Month&" "&$Date) Global $ExdraDays= GUICtrlRead($Tarneddinbut) ;ConsoleWrite($ExdraDays&@CRLF) Global $sIn_Date, $sOut_Date, $sIn_DateYear, $sOut_DateFull, $sOut_DateCalc, $sOut_DateNew $sIn_DateYear = "2022" ; @YEAR for current year or make a manual year specification like "2020" $sIn_Date = $sDates ;ConsoleWrite($sDates &@CRLF) $sOut_Date = _Date_Time_Convert($sIn_Date, "MMMM dd", "MM/d") $sOut_DateFull = $sIn_DateYear & "/" & $sOut_Date $sOut_DateCalc = _DateAdd("d", $ExdraDays, $sOut_DateFull) $sOut_DateNew = _Date_Time_Convert($sOut_DateCalc, "YYYY MM dd", "MMMM d") $deliveryDate = $sOut_DateNew If $deliveryDate = "--- -" Then $deliveryDate = '<p><span style=""color: #ff0000;"">Ask about delivery time</span></p>' ConsoleWrite($sDates & " >>>> "&$deliveryDate&@CRLF) At first it looked like it works, but , not working with 2digit dates. all dates must have 4 days added on. But it takes first digit and adds those 4 days to the first digit. Console output: July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 9 >>>> July 13 July 10 >>>> July 5 * July 9 >>>> July 13 July 9 >>>> July 13 July 14 >>>> July 5 * July 10 >>>> July 5 * July 9 >>>> July 13 July 30 >>>> July 7 * July 30 >>>> July 7 * July 9 >>>> July 13 July 19 >>>> July 5 * Lol there's no delete button for remove post. i figured out what's wrong. Date input have 2 space between characters, that made it broke. Edited July 4, 2022 by dersiniar Link to comment Share on other sites More sharing options...
Musashi Posted July 4, 2022 Share Posted July 4, 2022 25 minutes ago, dersiniar said: At first it looked like it works, but , not working with 2digit dates. all dates must have 4 days added on. My example works, see : Please post the ConsoleWrites for $ExdraDays and $sDates (before conversion) "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." 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