SMSHyd
September 29, 2015, 9:44am
1
Hi ,
In the form I have two fields , of type utcDateTime, when start date is selected it is taking time automatically as 12:00:00
for example
septermber 30 as 09/30/2015 12:00:00
For end time also it is taking same as above , Now the requirement is that it should take as 23:59:59
for example End date is October 3 2015 then it should take 10/03/2015 23:59:59 instead of 10/03/2015 12:00:00
is there any way to solve this
If you don’t specify time, it’s empty (represented as 0 seconds of the day). You can change it to another time, if you want, either manually or in code.
SMSHyd
September 29, 2015, 1:17pm
3
How can I get the maximum value of a date time of particular day i.e 09.29.2015 11:59:59 PM or
09.29.2015 23:59:59
Hi Smshyd,
you can use some methods to get the time your expecting:
cnlinToDateTime = DateTimeUtil::newDateTime(toDate,86399);
will give you 10/03/2015 23:59:59 of 10/03/2015 but here todate is date type and cnlinToDateTime is utcdateTime type.
Thanks,
Hima.
Instead of hard-coding 86399, use #secondsPerDay from macro library TimeConstants and subtract 1:
#TimeConstants
DateTimeUtil::newDateTime(toDate, #secondsPerDay - 1);
Alternatively, get the next day and then subtract one second (using DateTimeUtil::addSeconds() ).