DateTime field not accepting time


Author
Message
Wil Cantrell
Wil Cantrell
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 23, Visits: 129
We've created a scheduling application that stores a scheduled begin time and end time in the database. Both are System.DateTime values in .NET and datetime values in the database.

When updating the values, everything gets updated fine until I get to the begin time. If I set the value, the business object loses it's index and updates a different record with the correct date, but a midnight time.

For example, if StartTime is '2/25/2008 8:30 AM' and EndTime is '2/25/2008 2:00 PM' then after this:

if (CurrentScheduleDetailBO.NavigateToPrimaryKey(e.ScheduledEmployee.ScheduleDetailId, e.ScheduledEmployee.ScheduleId))

{
if (CurrentScheduledEmployeeBO.NavigateToPrimaryKey(e.ScheduledEmployee.EmployeeNumber, e.ScheduledEmployee.ScheduleId))
{

CurrentScheduleDetailBO.BeginMoment = startTime;
CurrentScheduleDetailBO.EndTime = endTime ;

// alternately, this does the same thing.
Runtime.
Static.CurrentScheduleDetailBO.CurrentRow["BeginMoment"] = startTime;
Runtime.
Static.CurrentScheduleDetailBO.CurrentRow["EndMoment"] = endTime ;

BeginMoment is '8/25/2008 12:00 AM' and the EndMoment is correct at '8/25/2008 2:00 PM'.

There are no triggers in the underlying datastore, nor are there any business rules that I can tell. EndMoment and every other datetime field I set is doing correctly. It's just the BeginMoment that is causing the problem.

____________________
Programmer/Analyst
Captain D's, LLC

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
We too have a scheduling application in our medical product as well as dates, and the one thing that I am VERY confident of is the fact that we do not change the time within the BO at any point.  There are only two places in the framework that we adjust the time portion of a DateTime:

  1. If binding to a DateTImePicker, there is a property called StripTimeFromValue, which by default is True.  So if you have this property set, it will set the time to midnight. 
  2. When searching within the BrowseDialog, we now have a Date tab that allows you to control the time of the browse DateTime control for a DateTime field.  You can leave the time alone, set the time to midnight, or the end of the day....but this is not way changes any underlying values...it is just for searching purposes

These are the ONLY two places in the framework that we adjust the time portion of a DateTime value.  So if I was to guess on this one, I would think that you are using an SF DateTimePicker control and have the StripTimeFromValue property set to True.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
One other thought on this too...if there were something in the framework actually stripping the time past what I mentioned in my previous post, I KNOW for a fact that this would be coming up from everyplace....and this is the first time I have ever heard of this.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search