Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, August 25, 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!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Get date from SQL server, not local machine
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jun 08 8:16 AM
I want to get the date from the SQL server or App server, not the local machine. When using 'Date' it returns the time for the local machine. How can I get the time from one of the servers? Thanks
[Reply][Quote]
Ted Sturr
Posts: 78
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jun 08 9:39 AM
Couldn't you just do a SQL query select gtedate() from the SQL server?

Ted
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jun 08 2:26 PM
You can also use GetUTCDate() function with SQL Server.

Timmus
[Reply][Quote]
Rob Bartram
Posts: 98
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jun 08 6:31 AM
You can also embed the GetUTCDate() function into any SQL insert or update statements to save a little processing time.

[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jun 08 11:35 AM
In general this practice should be avoided. In most cases the client's datetime is the appropriate value, not the server's. More importantly, this will cause data inconsistencies with remotes. If a transaction happens Jan 1st 8 AM on the server, the datetime field will read Jan 1st 8 AM (or the UTC adjusted value). The remote databases do not receive the transactions until a future time so their data will not read Jan 1st 8 AM.

Getting the server's datetime is the only business case I have encountered (and this thread is that encounter) that warrants bypassing the client side technologies at our disposal. I recommend as a best practice that client side datetime values be used: now in vbscript, DateTime.Now in C#, etc.

Timmus
[Reply][Quote]
Rob Bartram
Posts: 98
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jun 08 12:16 PM
Timmus,

Great point. We don't have remotes, so that's why I've not encounted any problems. I will have to remember this if/when we do implement remotes.

Thanks for the clarification.

...Rob
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jun 08 12:28 PM
Rob, I am happy to help.

I dont mean to step onto a soapbox but I do sense a common sentiment when it comes to sync: we dont have remotes now so we dont have to worry about it. Businesses are constantly changing as we all know. You very well may be asked to implement remotes tomorrow so treat your systems as if you do have sync. Granted, there are times the non-sync friendly solution is significantly cheaper, easier, etc. For those cases, you have to make an informed decision. However, it would be prudent to opt for the sync friendly techniques more often than not.

BTW, Steve, what is the reason for the Server DateTime requirement? If you are using SalesLogix datetime fields it stores the datetime as UTC. This is the beauty of UTC: it doesn't matter what timezone the client is in since it is adjusted to UTC before being stored in the database. I wonder if we are trying to solve a non-issue.

Timmus
[Reply][Quote]
Rob Bartram
Posts: 98
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jun 08 12:37 PM
Timmus,

I completely agree with you. It's just that we have a custom workflow process that relies on createdates and I needed a centralized time. If/When we do decide to open up remotes, It will be a full project to ensure the functionality of our heavy customizations - We have developed a complete staffing/recruiting & HR module in Saleslogix, so going remote will be no easy task.

I appreciate your insight.

...Rob
[Reply][Quote]
Ted Sturr
Posts: 78
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jun 08 3:34 PM
Timmus:

I can give you one example. When you are integrating with an outside system and you are using a time based sync scenario you want to make sure the date time value posted in a field is coming from one central source. This would have not impact on syncing with remotes because that date value is not relevant for a remote user, it is an "internally" used date for a specifice workflow.

That being said, I have to put in my soap box moment to state that I hate integration solutions that use a date / time value because you always have the chance to have records fall between the cracks. But that is for another thread and another day's topic.

Ted
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jun 08 3:41 PM
Thank you for indulging my curiousity, Ted. It does sound like your example is another can of worms for sure.

Timmus
[Reply][Quote]
LeVar Berry
Posts: 47
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Aug 08 6:12 AM
Tell me more about this Recruiting module. I am looking at building one myself for a client.

Is your module for sale?

[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Get date from SQL server, not local machineYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Aug 08 10:29 AM
If you don't have remotes, then it should't matter which time you use. Since SLX saves datetime fields in GMT, any difference between server time and client time means that one of the clocks is off.

BTW, for records created/modified in remotes, do the create and modify dates in the production database reflect when they were created/modified in the remote, or when they were synced to the production server?

[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): 8/25/2025 7:28:49 AM