Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 28, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: How to store a date-only field into the db?
Alberto Chiesa
Posts: 49
 
How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Feb 12 9:24 AM
fiogf49gjkf0d

Hi everyone.


Anyone knows how to store in the database a DateTime as a Date-only value (e.g., store 2010/02/09 00:00:00 in the SQL field)?


I have a (simple!) requirement to filter out a table based on two dates, but the SLX Web Client and/or the OLEDB provider are conjuring against me!


Whatever I try, I keep getting UTC-converted datetimes.


Thanks to everyone wanting to help!


 


Alberto Chiesa

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Feb 12 9:31 AM
fiogf49gjkf0d

Yes. In Architect DBMgr - always set the type to Date (not Date/Time). Whilst it's stored as a date-time it will lose the time portion (00:00:00.000). If you cannot change/drop the field then simply do this:


update sectabledefs set datetimetype = 'D' where tablename = 'yourtable' and columname = 'yourcolumn'


Then restart the slxserver.


 

[Reply][Quote]
Alberto Chiesa
Posts: 49
 
Re: How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Feb 12 9:46 AM
fiogf49gjkf0d

Hi Mike! Thank you.


Unfortunately, I already did it!!! Apparently, the web DateTimePicker control does not cope well with the DateOnly option.


The little bastard is still storing with my SLX User Timezone (-2). I almost forgot, I'm on SLX Web 7.5.4.


I'm kinda lost, at the moment. Should I set something else at web form configuration?


Anything else I could check?


 


Thank you again.


 


Alberto

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Feb 12 9:49 AM
fiogf49gjkf0d

Oh! Well, the provider (underneath) should honour this - not the control really ? That's very odd ! What is that you are trying to do (and from where) - as you maybe able to use Convert() instead and reformat it without the time etc.

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Feb 12 10:25 AM
fiogf49gjkf0d

Quote:
Originally posted by Alberto Chiesa


Unfortunately, I already did it!!! Apparently, the web DateTimePicker control does not cope well with the DateOnly option.



 


I have ran into this issue for quite a while, you need to do 2 things:


a) Properly set the Field definition (as shown on a Post Above)


b) On the TimePicker Control, set the following 2 properties as follows:


    1.- DisplayTime:  False (This is the Default)


    2.- Timeless:  False  (The default is True)


 


 


 

[Reply][Quote]
Alberto Chiesa
Posts: 49
 
Re: How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Feb 12 10:45 AM
fiogf49gjkf0d

Thank you guys!


The suggestion from Raul is on the right track. I tested thorougly the issue and found that:



  1. Setting the 'D' on the sectabledefs changes the oledb provider workings: it didn't change the field value anymore.

  2. If you only change that, the DateTimePicker will still apply conversions for the User's TimeZone, so it will SEEM that the oledb provider is messing with the date.

  3. The Timeless option should be set to TRUE (not false) in order to have the DateTimePicker disregard the TimeZone conversion thing: it will always set the SQL DateTime to 00:00:05 (5 seconds after midnight, don't ask me why...)


Having all my dates set to 5 seconds after midnight is good enough for my requirement.


Thank you much, guys, you're great!


 


Alberto

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Feb 12 11:04 AM
fiogf49gjkf0d

Quote:
Originally posted by Alberto Chiesa



  1. The Timeless option should be set to TRUE (not false) in order to have the DateTimePicker disregard the TimeZone conversion thing: it will always set the SQL DateTime to 00:00:05 (5 seconds after midnight, don't ask me why...)


Having all my dates set to 5 seconds after midnight is good enough for my requirement.



 


The 5 seconds past Midnight is how SLX knows a Date vs a DateTime for Conversion purposes (at least this is how it does it on the Activity table when the activity is set as "Timeless"), so we expect those 5 seconds past midnight to mean it is a Date with no Timestamp.

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: How to store a date-only field into the db?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Feb 12 10:14 PM
fiogf49gjkf0d

That's 'Z' time......SLX arbitrary convention to  ignore GMT \ time for DateTime type DB fields.

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/28/2025 11:31:56 AM