Manage Learn to apply best practices and optimize your operations.

The Secrets Of @Text

When you convert a date to a string, the @Text function has a very powerful
second argument that lets you specify how you want a date or time formatted in
a string.

The following is an example that automatically includes a year for a given date
only if that date falls outside the current year.

Create a document and entering first tomorrow's date, and then your birth date.
Tomorrow's date displays without the year, but your birth date displays with
the year -- unless you were born yesterday!

' Let's say you're already working with a document and you want to format the
date...

Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Set doc = ws.CurrentDocument.Document 'Shortcut alternative to explicitly
creating a NotesUIDocument

' A single Evaluate statement will format the date the way you like it
' @Text with a "D1" argument displays the year only if the date is a prior year
vTheDate = Evaluate ({@Text (TheDate; "D1")}, doc)
Msgbox vTheDate(0)

You can use the following codes for the @Text function's second argument (from
the Notes Help topic on @Text):


D0 -- Year, month, and day
D1 -- Month and day, year if it is not the current year
D2 -- Month and day
D3 -- Year and month
T0 -- Hour, minute, and second
T1 -- Hour and minute
Z0 -- Always convert time to this zone
Z1 -- Display zone only when it is not this zone
Z2 -- Display zone always
S0 -- Date only
S1 -- Time only
S2 -- Date and time
S3 -- Date, time, Today, or Yesterday
Sx -- Use when you cannot predict the exact format of the value being passed,
but you know that it will be either a time, date, or both.

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close