AW: Re: _DayValueToDate
"Stefan Lubitz" <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <00bd01c7660a$288a5910$2502a8c0@bluesbrother> |
I found something strange . Dim $Y, $M, $D $file = FileOpen(@ScriptDir & "\kal.txt", 0) $line = FileReadLine($file) $string=StringSplit($line,"-") ;$blub=2454414.5 $blub=$string[1] ;-->$blub results 2454414.5 MsgBox(0,"blub",$blub) $sJulDate = _DayValueToDate ($blub, $Y, $M, $D) --> not working $sJulDate = _DayValueToDate ($blub-0, $Y, $M, $D) --> working (the difference is the -0 statement) MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y) Regards, Stefan _____ Von: [email protected] [mailto:[email protected]] Im Auftrag von valery_vi Gesendet: Mittwoch, 14. März 2007 06:38 An: [email protected] Betreff: [AutoIt] Re: _DayValueToDate 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 AutoItList@yahoogro <mailto:AutoItList%40yahoogroups.com> ups.com, "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] > [Non-text portions of this message have been removed]