Login Page - Create Account

Support Board


Date/Time: Fri, 23 Feb 2024 16:07:16 +0000



[Programming Help] - SetDate() won't set only the date portion of a DateTime...

View Count: 162

[2023-10-17 20:32:10]
j4ytr4der_ - Posts: 892
Can't figure out what I'm doing wrong here. I'm trying to modify only the date portion of a datetime input, under certain conditions. But every time, it actually changes the type of the input from a datetime, to just a date. Same thing I try to modify only the time, it changes it to a time input instead.

Am I missing something simple? Here's the relevant code:



SCDateTime CurrentInputEndDateTime;
CurrentInputEndDateTime.SetDate(Input_ReplayEndDateTime.GetDateTime().GetDate());
SCDateTime CurrentInputStartDateTime;
CurrentInputStartDateTime.SetDate(Input_ReplayStartDateTime.GetDateTime().GetDate());

if(CurrentInputStartDateTime > CurrentInputEndDateTime
|| sc.ChartDataStartDate > sc.ChartDataEndDate
)
Input_ReplayStartDateTime.SetDate(Input_ReplayEndDateTime.GetDateTime().GetDate());


Every time, I just wind up with a date and no timestamp for my Input_ReplayStartDateTime input. Have tried every variation/approach to this I can think of. According to the documentation:



SetDate() sets the date part of the SCDateTime variable with the given Date. Date must be given as a Date Value.

The existing time portion of the SCDateTime variable is preserved when using the SetDate() function.

What have I overlooked here?
Date Time Of Last Edit: 2023-10-17 20:42:05

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account