Microsoft Dynamics Forums Homepage

Forum Home Forum Home > Microsoft Dynamics SL (Solomon) > SL - Customization and Integration
  New Posts New Posts RSS Feed - How to Use Dates
  FAQ FAQ  Forum Search   Register Register  Login Login


How to Use Dates

 Post Reply Post Reply
Author
Message
cchaney_64 View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: November 08 2007
Location: Texas
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote cchaney_64 Quote  Post ReplyReply Direct Link To This Post Topic: How to Use Dates
    Posted: September 29 2011 at 3:06pm
I'm creating a new screen using the SL SDK and need to calculate the time span between a record's creation date (crtd_datetime) and the current time. The SDO DH definition always maps SL dates to the integer data type so I've tried to convert that to a Vb.Net DateTime data type so I can perform Time Span calculations but it fails with a "Invalid cast from 'Int32' to 'DateTime'." message. How do we convert the integer data type from the SDO object to a VB.Net DateTime?
 

Dim StartDTS As DateTime

Dim EndDTS As DateTime

Dim WorkTimeSpan As TimeSpan

Dim HrsWorked As Double

StartDTS = Convert.ToDateTime(bWOHeader.Crtd_DateTime) <-- Code fails here

EndDTS = Now

WorkTimeSpan = EndDTS - StartDTS

Back to Top
Sponsored Links


Back to Top
williamjacks123 View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: October 08 2011
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote williamjacks123 Quote  Post ReplyReply Direct Link To This Post Posted: October 08 2011 at 2:58am
you brief very simply and best way how to use date. Nice job !!!
Back to Top
thewayofkahn View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 03 2012
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote thewayofkahn Quote  Post ReplyReply Direct Link To This Post Posted: September 03 2012 at 8:40pm
Did you ever find a solution for this? I'm having the same problem and it appears that no one answered your question.
Back to Top
hieuvt View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: January 17 2012
Location: Vietnam
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote hieuvt Quote  Post ReplyReply Direct Link To This Post Posted: September 10 2012 at 1:23am
I think you should convert bWOHeader.Crtd_DateTime to Str by using DateToStr. Then convert this string to datetime by using DateTime.Parse(String) function.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down


Copyright 2013 microsoftdynamicsforums.com. All rights reserved. MicrosoftDynamicsForums.com is an independent non-Microsoft website.
Email: contact AT microsoftdynamicsforums DOT com