Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 1. Strings, Dates, and Other Dat... > Converting a string to another data ...

Converting a string to another data type

Sometimes a string representation isn't enough. In order to perform certain actions, you need your data to be in a certain format. This recipe will show you how to change that data into a format that you can use.

How to do it...

  1. 1. Create a new codeunit from Object Designer.

  2. 2. Add the following global variables:

    Name Type Length
    DateText Text 30
    DateValue Date  


  3. 3. Write the following code in the OnRun trigger:

    DateText := '01/01/2010';
    EVALUATE(DateValue, DateText);
    MESSAGE('Date: %1', DateValue);
    
  4. 4. Save and close the codeunit.

  5. 5. When you run the codeunit you should see a window similar to the following screenshot:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial