how do i display the current week dates in salesforce? - salesforce

I am trying to display dates of current week. How can i do it? What i am trying to do is display the timesheet for the week.
So if i view the page today then it should display me the current week dates. Any pointers to approach this problem would be very helpful
Thanks
Prady

I would think you could use the Date.toStartOfWeek function and then use addDays to that Date 7 times to determine the rest of the days of the week.
The reference is here:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_date.htm

Related

Codename One - days of month

I am trying to build a week view of the month with customized cells, so the Calendar class won't work for me.
I am having trouble knowing on which day the month starts. For example, January 1st was a Friday. Also, I need to know how many days a given month has.
Without telling me the exact code, can you tell me the variables or methods I could use for this?
Look at the actual code for the Calendar class here: http://github.com/codenameone/CodenameOne/
Just set java.util.Calendar to the right date then use the get method to get the day of the week.

How to get last year's same week data in SOLR

How do I get last years same week data?
I used fq=trans_date:[NOW-1YEAR/DAY-7DAY TO NOW-1YEAR/DAY] on date field which will give me last 7 days data for last year. But that approach doesn't take into account calender weeks.
It's probably easier to calculate the boundaries for your week number last year in the frontend and then query Solr with the date interval. That way you can get the behavior you want regarding sundays/mondays as well.
Solr does not provide a nice way to do this.
It would be really cool if you could do fq=trans_date:[NOW-1YEAR/WEEK TO NOW-1YEAR/WEEK] but this is not supported.
Nevertheless, you could create a quick function using php or javascript using each language's native Date operators and get the Week number from today to produce start and end points to feed solr in a query like [1995-12-31T23:59:59.999Z TO 2007-03-06T00:00:00Z].

Combining calendar and array in Delphi 7

I'm working on a project in Delphi 7. I'm trying to let a user select a day by clicking on a day on the TCalendar component, the corresponding day has to be found in an array and the event should be displayed. Any ideas how to do let the user select a day on the calendar and use this as a variable?
Any ideas how to do let the user select a day on the calendar and use this as a variable?
Read the calendar date with the CalendarDate property. Or the Day, Month and Year properties. Exactly how you then look up your events depends on how your events are stored.

ExtJS 4.2 DatePicker get the first day and last day in the calendar

I have an ExtJS datepicker where I disable some dates so the user can't select them.
After the calendar is renderer I send to the server the current date and the server sends back an array of days to disable, so the visual result is the following:
The problem I have is that I don't know the first and last day showed in the datepicker.
In this image the first day is 08/31/2014 and the last day is 09/11/2014. How can I get those dates, so I can tell my server to check if within that range I have to disable any date.
In the calendar example the "yellow marked dates" have to been disabled.
Any clue? Appreciate in advance.
Check this fiddle: https://fiddle.sencha.com/#fiddle/8ms
this uses minDate, maxDate with disabledDates, disabledDays combination..to enable particular days and disable all other days.
You could arbitrarily set the minValue to this month's first day and maxValueto this month's last day and then assume this on the backend side.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Date-cfg-minValue
Here's how to get current month's first and last day
Get first and last date of current month with javascript or jquery

how do we get the first and last day of the current month

How do we get the first day of the month and last day of the month. i am using it on a apex class.
i can get the todays date by using
date.today()
but how would i get the first and last day of the month.
Thanks
You should get familiar with the Apex Code Developers Guide as it has very good documentation for questions like this. Here's the Date methods page that you would find helpful.
With respect to your specific question, you get the first date of the month (I'll use today's month in my example) using the following
Date firstDayOfMonth = System.today().toStartOfMonth();
To get the last day of the month, use the following:
Date lastDayOfMonth = firstDayOfMonth.addDays(Date.daysInMonth(firstDayOfMonth.year(), firstDayOfMonth.month()) - 1);
I think there is a better way to solve the second problem, that is, accept the last day of the month.
firstDayOfMonth.addMonths(1).addDays(-1);

Resources