AppNotificationBuilder.SetTimeStamp(DateTime) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
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.