Re: _DayValueToDate
"valery_vi" <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
This works for me: #include <Date.au3> ; Julian date of today. $sJulDate = _DateToDayValue (@YEAR, @MON, @MDAY) MsgBox(4096, "", "Todays Julian date is: " & $sJulDate) ; 14 days ago calculation. Dim $Y, $M, $D $sJulDate = _DayValueToDate ($sJulDate-14, $Y, $M, $D) MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y) $test = "2454429.5" ; 14 days ago calculation. Dim $Y, $M, $D $sJulDate = _DayValueToDate ($test-14, $Y, $M, $D) MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y) $file = FileOpen(@ScriptDir & "\kal.txt", 0) $line = FileReadLine($file) $string=StringSplit($line,"-") $blub=$string[1] ;-->$blub results 2454414.5 MsgBox(0,"blub",$blub) $sJulDate = _DayValueToDate ($blub, $Y, $M, $D) MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y) File 'kal.txt' is in script directory and has only line: 2454414.5-some date It uses AutoIt v.3.2.2.0. Valery --- In [email protected], "Stefan Lubitz" <stefan@...> wrote: > > Hi all, > > I have got a strange problem :-[ > > I tried to calculate some Dates in the following ways: > > > > This is working: > > ; Julian date of today. > $sJulDate = _DateToDayValue (@YEAR, @MON, @MDAY) > MsgBox(4096, "", "Todays Julian date is: " & $sJulDate) > ; 14 days ago calculation. > Dim $Y, $M, $D > $sJulDate = _DayValueToDate ($sJulDate-14, $Y, $M, $D) > MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y) > > > > This is working also: > > $test = "2454429.5" > > ; 14 days ago calculation. > > Dim $Y, $M, $D > > $sJulDate = _DayValueToDate ($test-14, $Y, $M, $D) > > MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y) > > > > But this is not working, and I don't know why: > > $file = FileOpen("c:\kal.txt", 0) > > $line = FileReadLine($file) > > $string=StringSplit($line,"-") > > $blub=$string[1] ;-->$blub results 2454414.5 > > MsgBox(0,"blub",$blub) > > Dim $Y, $M, $D > > $sJulDate = _DayValueToDate ($blub, $Y, $M, $D) > > MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y) > > > > > > Regards, > > Stefan > > > > > > Where is the difference between a Variable I write manually (like $test) and > the Variable $blub, which has the same value????? > > > > [Non-text portions of this message have been removed] >