Custom timestamp on toast notifications – Windows 10 Creators Update

Note: The new feature(s) covered in this post are available to Windows Insiders running build 15002 or newer. If you are using the NuGet UWP notification extension library, the feature(s) can be found in the beta version here.

New in Creators Update: App developers can now specify a custom timestamp on their notifications!

Currently, toasts have a timestamp at the bottom left corner, as shown below. The timestamps are generated based on the notifications’ arrival times. If the notification comes from WNS via push, we display the time when the notification arrived at the WNS server. If the notification is generated locally, we display the time when the notification platform received it.


In general, we recommend that most apps specify a custom timestamp. This ensures that the notification’s timestamp accurately represents when the message/information/content was generated, regardless of network delays, airplane mode, or the fixed interval of periodic background tasks.

For example, a news app might run a background task every 15 minutes that checks for new articles and displays notifications. Before custom timestamps, the timestamp corresponded to when the toast notification was generated (therefore always in 15 minute intervals). However, now the app can set the timestamp to the time the article was actually published. Similarly, email apps and social network apps can benefit from this feature if a similar pattern of periodic pulling is used for their notifications.

Additionally, providing a custom timestamp ensures that the timestamp is correct even if the user was disconnected from the internet. For example, when the user turns their computer on and your background task runs, you can finally ensure that the timestamp on your notifications represents the time that the messages were sent, rather than the time the user turned on their computer.

Now let’s take a look at how it works…

When constructing the notification payload, you just need to include the desired timestamp using the new timestamp property/attribute as shown below. If you are using XML, the date must be formatted in ISO 8601.

Note: You can only include at most 3 decimal places on the seconds (although realistically there’s no value in providing anything that granular). If you provide more, the payload will be invalid and you will receive the “New notification” notification.

ToastContent toastContent = new ToastContent()
    DisplayTimestamp = new DateTime(2016, 12, 13, 12, 45, 5),
    Visual = new ToastVisual() { ... },
    Actions = new ToastActionsCustom() { ... }
<toast displayTimestamp="2016-12-13T20:45:00Z">




And then the toast will use the timestamp you provided. Note that you cannot assign a time in the future that is greater than the system time.


Comments (2)

  1. Sorry, my original reply is awaiting approval:All paths to files should work (e.g. anything that works directly with CreateFile should work). This with the caveat that you have to be in full trust if you want to use \\?\ as opposed to \\.\.For pipes you need to go through System.IO.Pipes as FileStream has a specific check for handle type. is currently no alternative for mailslots unfortunately as the logic for determining sync/async in FileStream doesn’t work with mailslot handles (so you can’t even pass a handle you open yourself).

  2. someone can provide some code example for the “Soft Keyboard”?

Skip to main content