Is there a way to find the year Today and The Week nr. today in Ilogic

Is there a way to find the year Today and The Week nr. today in Ilogic

Darkforce_the_ilogic_guy
Advisor Advisor
1,124 Views
4 Replies
Message 1 of 5

Is there a way to find the year Today and The Week nr. today in Ilogic

Darkforce_the_ilogic_guy
Advisor
Advisor

I want to make an ilogic code that open an excel doc.. when the neweste doc always is in an folder call the current year and the excel doc is call the week nr. 

 

how do I get the years and week nr in ilogic 

0 Likes
Accepted solutions (1)
1,125 Views
4 Replies
Replies (4)
Message 2 of 5

marcin_otręba
Advisor
Advisor
Accepted solution
MessageBox.Show(DatePart("ww", Today, vbSunday), "Title")
MessageBox.Show( Today.Year, "Title")

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 3 of 5

WCrihfield
Mentor
Mentor
'General Date Format Example
Dim oGenDate As Date = FormatDateTime(Now, DateFormat.GeneralDate)

'Long Date Format Example
Dim oLongDate As Date = FormatDateTime(Now, DateFormat.LongDate)

'Long Time Format Example
Dim oLongTime As Date = FormatDateTime(Now, DateFormat.LongTime)

'Short Date Format Example
Dim oShortDate As Date = FormatDateTime(Now, DateFormat.ShortDate)

'Short Time Format Example
Dim oShortTime As Date = FormatDateTime(Now, DateFormat.ShortTime)

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 5

WCrihfield
Mentor
Mentor

Also when you type in something line 'Now' or 'Today' or 'Date' in the iLogic Rule Editor, then the dot right after it, you can see all the available options available under it.

Here's a fairly good tip for the week number of the year, too.

Get the week number of the year counting from a given date in vb 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5

WCrihfield
Mentor
Mentor

@Darkforce_the_ilogic_guy 

Forgot to mention, that you'll need specify (Imports System.Globalization) in the header of the iLogic rule to use the method shown in the StackOverFlow example.  See below simplified example.

Imports System.Globalization

Dim oDFI = DateTimeFormatInfo.CurrentInfo
Dim oCal = oDFI.Calendar
Dim oWeekOfYear = oCal.GetWeekOfYear(Now, oDFI.CalendarWeekRule, vbSunday)
MsgBox(oWeekOfYear,vbOKOnly," ")

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)