How would I default the time to 11:59:59 PM on a calendar drop down.
For what date, today?
if so, bind the calendar’s date to the following expression:
toDate(dateFormat(now(0), 'yyyy-MM-dd') + ' 23:59:59')
what about something like the following…
event.source.parent.getComponent(‘Start’).latchedDate = todate(dateFormat(now(0), ‘yyyy-MM-dd’) + ’ 00:06:00’)
The Start component is a calendar, i have another one called End as well. These are used for selecting a beginning and ending date/time range that i am feeding to a report
i have a series of buttons on my window named the following
When the user clicks the today button, I want to write a script that sets the start calendar day to today at 6:00:00 and sets the end calendar day to today at 18:00:00
perhaps there is an easier way to do this???
Scripting would be a fine way to do this, but your example mixes up python with the expression language. To do this in scripting you use the java.util.Calendar class. The correct script would be something like this for the “Today, 6am-6pm” button:
[code]from java.util import *
start = event.source.parent.getComponent(“Start”)
end = event.source.parent.getComponent(“End”)
cal = Calendar.getInstance()
cool, that works perfect!
how could you take this one step further and select the start to be the first day of the week, and the end to be the last day of the week?
Check out that documentation page I linked to for java’s Calendar class. Set the DAY_OF_WEEK field to one of the constants defined here. (like SUNDAY=1, MONDAY=2, etc)
Cool, got them all to work. Thx for your help.
No problem, glad you got it working!