Re: _DayValueToDate

jvdzande <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
--- In [email protected], "Stefan Lubitz" <stefan@...> wrote:
The func expects a number in stead of a string:
Try this version:
#include<date.au3>
$file = FileOpen("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 (Number($blub), $Y, $M, $D)
MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y)

Jos


> 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]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.