Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, August 29, 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: Convert String to Date
Andrew Fink
Posts: 41
 
Convert String to DateYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Aug 09 11:20 AM
Hello everyone, I'm sure this is a very simple question but I am having a hard time finding how Saleslogix wants a date formatted. I am getting a date from a user with a DateTimeEdit control then attempting to create an activity for the next month.

I think it will work once I figure out how Saleslogix wants the Date string formatted to be converted into a Date type.

Here is what I have so far:
Sub DateTimeEdit1Change(Sender)
Dim Act
Dim SlashPos
Dim strDate
Dim strMonth
Dim newMonth
Dim dateRight
Dim newDate
Dim strLen
strDate = DateTimeEdit1.DateTime
slashPos = InStr(strDate,"/")
strMonth = Left(strDate, (slashPos - 1))
newMonth = strMonth + 1
strLen = Len(strDate)
dateRight = Right(strDate, (strLen - slashpos))
newDate = newMonth & "/" & dateRight & "12:00:00"
Set Act = Application.Activities.Add(atPhoneCall)
Act.AccountID = Application.BasicFunctions.CurrentAccountID
Act.AccountName = Application.BasicFunctions.CurrentAccountName
Act.StartTime = newDate
Act.OpportunityID = Application.BasicFunctions.CurrentOpportunityID
Act.Alarm = 1
Act.AlarmTime = newDate
Act.Category = "Order Final Documents"
Act.Title = "Order Final Documents"
Act.Save
MsgBox("Activity Saved")

Thanks,
Andrew
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Convert String to DateYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Aug 09 11:59 AM
Use CDate to convert the date.
If you need to add a Month it may be easier to do so as a a Date as well (see sample function below)

Dim strDate
Dim dt

strDate = "01/06/2009 12:15:00"
dt = CDate(strDate)

'Add a Single Day
dt = CDate(CDbl(dt) + 1)
msgbox dt ' Will show 1/7/2009
'Add a Month
dt = AddMonth(dt)
msgbox dt ' Will show 2/7/2009


Function AddMonth(dt)
Dim m
Dim y
m = Month(dt)
y = Year(dt)
Select Case m
Case 1, 3, 5, 7, 8, 10, 12:
dt = CDate(CDbl(dt) + 31)
Case 2:
if (y Mod 4) = 0 then
dt = CDate(CDbl(dt) + 29)
Else
dt = CDate(CDbl(dt) + 28)
End If
Case 4, 6, 9, 11:
dt = CDate(CDbl(dt) + 30)
End Select

AddMonth = dt
End Function
[Reply][Quote]
Andrew Fink
Posts: 41
 
Re: Convert String to DateYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Aug 09 12:33 PM
Raul,
Thank you! That works perfectly. Awesome how it considers different number of days in a month.

Andrew
[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/29/2025 2:10:09 PM