1

Can somebody help identify the format of this date and time (timestamp). THe webhook I am currently trying to have a link to has a security requirements where I need to get the timestamp. However, the format of the timestamp is new to me. See below the format:

The formatted timestamp converted to string should look like this:

1496734173

I have no idea how do I convert a date and time into something like this. I don't know what this code is or what time does it actually tells.

Click Here for the format

  • 2
    It *may* be a unix timestamp, but really, you need multiple examples of numeric values and *the datetime they are meant to correspond to* to be sure. Anyone can invent an arbitrary mapping and pick any epoch and smallest time unit to count. – Damien_The_Unbeliever Jul 08 '22 at 09:54
  • @Damien It seems likely that it is. If it isn't, [so] isn't the correct place to ask for more details. OP would need to contact whoever runs the webhook and ask them what the number represents. – ProgrammingLlama Jul 08 '22 at 09:57

2 Answers2

4

That looks like a pretty standard UNIX epoch timestamp. Assuming we're using the UTC (GMT) timezone, the date is Tuesday, June 6, 2017 7:29:33 AM.

UNIX time is the amount of seconds that have passed since Jan 1, 1970. The timestamp means 1496734173 seconds have passed since then, which is about 47 and a half years, i.e. June 6, 2017.

You can convert a DateTime object to a UNIX timestamp in the following way:

DateTime dateTime = DateTime.Now; // this would be your DateTime
DateTimeOffset offset = new DateTimeOffset(dateTime);
long epoch = offset.ToUnixTimeSeconds(); // our epoch is a 64 bit integer, i.e. long

Or, in one line:

long epoch = new DateTimeOffset(dateTime).ToUnixTimeSeconds();
dimitar.bogdanov
  • 387
  • 2
  • 10
1

I think that this represents the UNIX timestamp.

The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC.

Here you can try and convert your timestamp here: check your time

aca
  • 1,071
  • 5
  • 15