IsDateDMY Equivalent in Formula language?

Does anyone know if there is a way to determine the Date format being used by the client in the Formula language similar to the IsDateDMY, IsDateMDY, IsDateYMD properties found in the NotesInternational class? Would like to use it in a Computed Text field or a Computed When Displayed field.

Possibly using the @Environment formula?

Thanks

Subject: IsDateDMY Equivalent in Formula language??

There is no built-in equivalent, no, but creating an equivalent isn’t that difficult. Start with a known date that has no ambiguous parts (ie, you can tell the day from the year from the month without guessing), such as January 2, 2000:

standardDate := @Date(2000; 1; 2);

then convert the value to text:

txtDate := @Text(standardDate);

then replace the components with yyyy, mm, dd as appropriate:

textFormat := @ReplaceSubstring(txtDate; “2000” : “00” : “01” : “1” : “02” : “2”; “YYYY” : “YY” : “MM” : “M” : “DD” : “D”)

Subject: RE: IsDateDMY Equivalent in Formula language??

Stan,

Thank you for your response. Since I want the application to work across multiple locations, but want the dates represented on the forms according to their settings, I really need to know which setting was being used. I resolved it by adding code in the PostOpen event to set a Computed when Display value that is used by any Formula language for the appropriate conversion.

Here is the code I used:

Sub Postopen(Source As Notesuidocument)

Dim s As New NotesSession

Dim doc As NotesDocument

Dim international As NotesInternational

Dim Code As Integer

'Default to MDY if unable to determine

Const DMY = 1

Const MDY = 2

Const YMD = 3

Set doc = source.Document

Set international = s.International

If international.IsDateDMY Then

  Code% = DMY		

Elseif international.IsDateYMD Then

  Code% = YMD

Else

  Code% = MDY

End If

doc.DLG_InternationalCode = Code%

End Sub


Then as an example of one of the Formulas…

IntCode := DLG_InternationalCode;

@If(IntCode = 1; Do something…;

  IntCode = 3; Do something else....;

  Else do this.....

  );

Subject: RE: IsDateDMY Equivalent in Formula language??

No, you don’t need to know what setting is being used if you are dealing with date fields – just set them to use the user’s settings. The only use I’ve seen for forced formatting is in internationalised web applications (use users accept-language to determine settings) in order to modify the way JavaScript handles date strings. In the client, there is no good reason for dates to flip back and forth between true dates and text, except in a history digest where dates are concatenated with other values – and in that case you want to force a single uniform format across all regions/settings, not just for presentation, but in order to reliably extract the date component from the history entry.