AppNotificationBuilder.SetTimeStamp(DateTime) Method

Definition

Sets the custom time stamp for an app notification.

public:
 virtual AppNotificationBuilder ^ SetTimeStamp(DateTime value) = SetTimeStamp;
AppNotificationBuilder SetTimeStamp(DateTime const& value);
public AppNotificationBuilder SetTimeStamp(System.DateTimeOffset value);
function setTimeStamp(value)
Public Function SetTimeStamp (value As DateTimeOffset) As AppNotificationBuilder

Parameters

value
DateTime DateTimeOffset

A DateTimeOffset value specifying the value for the custom time stamp.

Returns

Returns the AppNotificationBuilder instance so that additional method calls can be chained.

Examples

The following example demonstrates setting the custom time stamp in the XML payload for an app notification.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .SetTimeStamp(DateTimeOffset.Now)
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast displayTimestamp='2022-10-25T15:54:31-07:00'>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
</toast>

Remarks

The following screenshot illustrates the placement of the custom time stamp.

A screenshot of an app notification with a custom timestamp.

For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.

For reference information about the XML schema for app notifications, see App notification content schema.

Applies to