I haven’t worked much with dates in Xojo; nothing beyond getting the current date and formatting it the way I want.
For this application I’m building I’m displaying the date as an SQLDate formatted as (today would be): 2000904.
Year 2020 = 20
Month 9 = 09
Day 4 = 04
This becomes the default text of a textbox and is used as the first part of a naming convention for a column in one of our tables of the DB.
I was just told I need to make that date be 3 weeks in the future, on Tuesday.
So using today as the example from above (200904)
The date should actually display 200922, as that is 3 weeks away on Tuesday.
I’m having a rather difficult time figuring this out without coding a bunch of if statements and selects. Which I’m not doing because it seems like a waste of time. There has to be a cleaner more efficient way.
Here is my current code so you can at least see my thought process.
dim d as new date
dim todaysDate as string
todaysDate = d.SQLDate
dim d2 as new date
dim futureDate as string
futureDate = d2.SQLDate
//todaysDate
dim day As Integer = d.DayOfWeek
dim week as integer = d.WeekOfYear
dim dd as String
dim mm as String
dim yy as string
yy = todaysDate.Left(2)
mm = todaysDate.Mid(6, 2)
dd = todaysDate.Mid(9, 2)
dim ddd as integer = val(dd)
ddd = ddd + 21
todaysDate = (yy + mm + dd)
//futureDate
dim newDay as integer = 2
dim newWeek as Integer = week + 3
dim dd2 as string
dim mm2 as string
dim yy2 as string
yy2 = futureDate.left(2)
//mm2 =
futureDate = (yy + mm + newDay.ToText)
MsgBox("Todays date: " + todaysDate)
MsgBox("1st Tuesday 3 weeks from today: " + futureDate)
Any ideas to point me in the right direction?