---
title: "Getting  timestamp from incoming xmpp message"  
description: "Getting  timestamp from incoming xmpp message"  
author: "Anonymous User"  
published: 2015-06-16  
updated: 2015-06-17  
canonical: https://www.mindstick.com/forum/23299/getting-timestamp-from-incoming-xmpp-message  
category: "android"  
tags: ["android"]  
reading_time: 2 minutes  

---

# Getting  timestamp from incoming xmpp message

I am using aSmack [library](https://www.mindstick.com/forum/34615/software-framework-vs-library) to communicate with [remote](https://www.mindstick.com/articles/85431/remote-employee-training-tips-tricks) xmpp server. I am able to send/[receive messages](https://answers.mindstick.com/qa/113102/why-can-t-i-send-or-receive-messages-on-whatsapp), but I want to get [timestamp](https://www.mindstick.com/interview/791/what-does-timestamp-on-update-current_timestamp-data-type-do) of incoming message.

Could you tell me please, is it possible at all?

## Replies

### Reply by Anonymous User

Where the Timestamp is not part of the regular [messages](https://www.mindstick.com/news/4166/google-rolling-out-gemini-extensions-for-messages-whatsapp-and-spotify). Therefore you cannot extract it. There is a spec (as mentioned by @Dmitry), but this only applies to specific types of messages. Typically those that are NOT realtime, such as offline and publishing the last pubsub message of a node when a new subscription is created. These are messages with an inherent delay built into the Due to specs time is the required attribute for XMPP message: \
http://xmpp.org/extensions/xep-0203.html#protocol\
\
Check the <delay> item of <message>: \

```
<delay xmlns='urn:xmpp:delay' from='capulet.com' stamp='2002-09-10T23:08:25Z'>Offline Storage</delay> 
```

But getting it looks a bit tricky. As soon as aSmack is recompiled Smack with some replaced stuff, so try to get it the way like here: \

```
DelayInformation inf = null;try {    inf = (DelayInformation)packet.getExtension("x","jabber:x:delay");} catch (Exception e) {    log.error(e);}// get offline message timestampif(inf!=null)    Date date = inf.getStamp();
```

\
Probably, you will need to check what server sends with a message as extension value and replace "jabber:x: delay" with 'urn:XMPP: delay' as it is shown in XMPP specs example. \
But not sure if it works.


---

Original Source: https://www.mindstick.com/forum/23299/getting-timestamp-from-incoming-xmpp-message

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
