Salesforce

How Do I Convert a Date Value to a String? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Convert a Date Value to a String? (Magic xpa 4.x)

A date value in Magic xpa is basically numeric, and stored as the number of days since the year zero. When you display a date on a form, however, you normally do not need to convert it, because Magic xpa does that automatically, according to the picture property in the control.

However, when you want to include the date in a string -- for instance, in a Verify Operation box -- then you need to convert the date to a string. This is done using the DStr() function, as shown below.

Date Pictures

Whenever you display a date, you have a lot of formatting options in Magic xpa. The picture of the date determines how it is displayed. The picture is basically a kind of template that interprets the date. Letter placeholders are used to indicate how the date should be interpreted. For example, for the date “June 30th, 2007”:

Picture

How it displays as a string

Notes

MM/DD/YY

06/30/07

DD/MM/YYYY

30/06/2007

YYYYMMDD

20070630

YYYY-MM-DD

2007-06-30

YYYY

2007

YY

07

MMMM

June

DDD

181

Julian date (nth day of the year)

DDDD

30th

WWW

Sat

WWWWWWWWW

Saturday

##/##/####

Depends

Depends on how Settings->Environment-> International ->Date Mode is set.

Using DStr()

The syntax of DStr() is:

DStr (date, picture)

Returns: A formatted date string. DStr() uses pictures to format the string.

See also

The Online and Rich Client Samples projects (program DT17 and RDT17)

Reference
Attachment 
Attachment