Jump to content
Sign in to follow this  
Datus

Want to get Date from @YDAY [resolved]

Recommended Posts

Datus

Trying to find a way to convert @YDAY variable (gives the day of the year) to a date eg YYYYMMDD

Tried help and search forum but nothing so far.

Any Idea's

Background info.

Reason I want to do this is to predict when a drive will fill.

I find out how many days it will take to fill it then add it to @YDAY and then display that in a format anyone can understand.

Edited by Datus

We live as we dream alone!

Share this post


Link to post
Share on other sites
charvi

This example can guide you to the right direction:

#include <Date.au3>

; Julian date of today.
$sJulDate = _DateToDayValue (2009, 01, 01)
MsgBox(4096, "", "Todays Julian date is: " & $sJulDate)


; YDAY difference calculation
Dim $Y, $M, $D
$sJulDate = _DayValueToDate ($sJulDate+@YDAY-1, $Y, $M, $D)
MsgBox(4096, "", "@YDAY difference from 2009-01-01: " & $Y & "/" & $M & "/" & $D)

Share this post


Link to post
Share on other sites
Datus

Cheers works using the example given.

Just wanted to make sure there wasnt an easier way.

#include <Date.au3>

; Julian date of today
$Daysleft=58
$sJulDate = _DateToDayValue (2009, 01, 01)
MsgBox(4096, "", "Todays Julian date is: " & $sJulDate)
$sJulDate = $sJulDate + $Daysleft

; YDAY difference calculation
Dim $Y, $M, $D
$sJulDate = _DayValueToDate ($sJulDate+@YDAY-1, $Y, $M, $D)
MsgBox(4096, "", "@YDAY difference from 2009-01-01: " & $Y & "/" & $M & "/" & $D)

We live as we dream alone!

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.