Calendar Modification

Anyone knows if it is possible to modify the time style in pop-up calendar properties? you have 3 options of user selectable, start of the day and end of the day, it would have been great you could change the start of the day from 00:00:00 to whatever you want and same thing with the end. Now in case that’s not possible is there anyway i can set a pop-up calendar to jump to a certain time of the day that a user picks? like if they pick June 24th, it automatically picks 07:00:00.
right now i have two pop-up calendars one for start one for end day, i’ve set the end date to Now(0) and i’ve send the start to

dateArithmetic({Root Container.Group 3.End.date}, - 7, "day")

so i can get whatever current day is minus 7 days, I want to somehow be able to say ok, go back 7 days but also start at 07:00:00, any ideas?
Thanks

You can make a custom property you can add 7 hours to.

When I need to do this, I’ll have two properties, one for the final Target date and on for an offset.

Then, If you need one a week before, you can do another dateArithmetic on the offsetted date.


I understand your approach, my thing is, I want whatever date that the user selects automatically picks 7am as it’s start time, now here if I’m not mistaken you’re just adding 7 hours to the date and time that the user picks in the drop down calendar and that becomes your offsetdatetime, or am i misunderstanding this?

That’s exactly right. My Offset time becomes my start of shift. I will bind to that instead of the date in the calendar.

but that Expression you wrote adds 7 hours to the date that is picked by user and you make that your offset time and if you pick that as your start time that means your start time is always 7 hours ahead? trying to mess with this for almost 10 hours wasn’t probably the best idea… :open_mouth:

Try this:

  1. Add a dynamic property to the calendar, called fixedDate. Datatype of Date.

  2. Add an property change event script as follows:

if event.propertyName == "date":
	from java.util import Calendar
	cal = Calendar.getInstance()
	cal.setTime(event.newValue)
	cal.set(Calendar.HOUR_OF_DAY,7)
	event.source.fixedDate = cal.getTime()

That should give you a property that will always be set to the 7th hour of the day. Obviously, with some coding, you can make this hour dynamic.

Also, Jordan’s answer assumes you have the mode of the calendar set to start of day. It does not matter for my method.

Its amazing how giving your brain a few hours of rest help, sitting in front of my computer at 9 last night and suddenly it hit me… so I made two Expression tags called one StartOfDay and one EndOfDay,

in StartOfDay I used :
dateFormat(Now(0), "yyyy-MM-dd 07:00:00") 
and in the EndOfDay i used
dateArithmetic({[.]StartOfDay, 86399, "sec")

Now made two pop up calendars and bind the first one to StartOfDay and second to EndOfDay and works great, any date i pick for start it shows data starting at 7am and end is always at 6:59am next day.
One down, many to go but hey, progress is progress!!! :thumb_right: :thumb_left: