question

andymeer avatar image
andymeer asked jeff-davies answered

How is TimeStamp created

Hi All

Would somebody be kind enough to explain the timestamp format for me please?

Say I am trying to get the Orders from midnight on the first of jan though to today what would be the time stamp for both dates

Thanks in anticipation

Andy

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

James Tickett avatar image
James Tickett answered

The format is called "epoch time". It counts the number of seconds that have elapsed since Jan 1st 1970. If you google "epoch converter", the first result is a very useful tool that will probably help explain more. (http://www.epochconverter.com/)

That website is useful for having a few dates to test with, but when you need to convert within your program, it obviously depends on which language or platform you are using (e.g. Android/Windows Service/Web App) as to how you achieve this.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jeff-davies avatar image
jeff-davies answered

The format is a Javascript date/time stamp in long format. The first answer is correct for epoch time. However the format used by javascript is actually the number of milliseconds since Jan 1, 1970. Since the clover devices have a time resolution in seconds, not milliseconds, you will usually see all of the date/time stamps ending with three zeros.

If you want an online tool to quickly convert these long integers into a date/time that you can read, check out TimeStampConvert.com. It will also allow you to enter date/time stamps in a human readable format and convert them to epoch time or javascript time (aka Unix timestamp)

Why does clover use milliseconds? Well, I'm not a clover dev, but I suspect the logic behind this is pretty simple. Clover is returning data in JSON format, so it only makes sense to return date/time stamps in javascript format also.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

andymeer avatar image
andymeer answered

Hi Guys Thanks for the explanation

Andy

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community