Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Finding the Week Day in a Date...
Krelek1000
I was wondering if there is any function that allows some one to find a the number value of the week day of a date?
I am trying to create a formula that shows the date of the end of a week.
var Tdate = rows("DATE");
var WeekDay = (missing Formula);
WeekDay = (Weekday - 2) * -1;
var EndOfWeekDate = DateTimeSpan.addDate(Tdate, 0, 0, WeekDay);
So what do you think?
Ben
Find more posts tagged with
Comments
johnw
Maybe something like
var formater = new Packages.java.text.SimpleDateFormat("EEE");
var result = formater.format(param["Date"]);
var dayOfWeek = -1;
if (result.equals("SUN"))
{
dayOfWeek = 0;
}
if (result.equals("MON"))
{
dayOfWeek = 1;
}
//etc
You could also make it easier by using a GregorianCalendar and doing something like:
var calendar = new Packages.java.util.GregorianCalendar(param["Date"].getYear(), param["Date"].getMonth(), param["Date"].getDay());
var numericDayOfWeek = calendar.get(Packages.java.util.Calendar.DAY_OF_WEEK);
Hope that helps.
John