Quantcast Time-Date Stamp a mystery - ESOUI
Thread Tools Display Modes
10/11/14, 02:01 PM   #1
dopiate
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 147
Time-Date Stamp a mystery

I'm writing a support tool for an addon but I can't figure out what format the timestamp is

here are a few example:

1410642972
1410643006
1410643071

is that format convert-able outside LUA - or maybe I can change it to something easier to work with before it hits the saved variables.

But even then I have 7000 entries to convert anyway :-)

Any help apreciated.

-d
  Reply With Quote
10/11/14, 02:27 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
It's what timestamp usually means - unix time.

Originally Posted by dopiate View Post
is that format convert-able outside LUA - or maybe I can change it to something easier to work with before it hits the saved variables.
-d
That depends on what you mean by "outside LUA". In Unix/Linux command line, you can use the date command: date -d '@1410642972'. In Python, there are modules time and datetime. Any sensible language has some library to work with unix timestamps.

I wonder what you mean by "something easier to work with". A timestamp is a single number with well-defined meaning, it's not susceptible to peculiarities like other date/time formats (timezone, DST). I think it's best to save timestamps, and only convert for display to users.
  Reply With Quote
10/11/14, 02:56 PM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 853
You can try conversion from timetamp here:
http://www.epochconverter.com/

1410642972 = 09/13/2014 @ 21:16:12 UTC
1410643006 = 09/13/2014 @ 21:16:46 UTC
1410643071 = 09/13/2014 @ 21:17:51 UTC

On the same page is also explained how to get timestamp and how to convert it to human readable form.
__________________
@Garkin (retired from ESO)
My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you!, ... (full list)
  Reply With Quote
10/11/14, 03:34 PM   #4
dopiate
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 147
Originally Posted by merlight View Post
It's what timestamp usually means - unix time.

That depends on what you mean by "outside LUA". In Unix/Linux command line, you can use the date command: date -d '@1410642972'. In Python, there are modules time and datetime. Any sensible language has some library to work with unix timestamps.

I wonder what you mean by "something easier to work with". A timestamp is a single number with well-defined meaning, it's not susceptible to peculiarities like other date/time formats (timezone, DST). I think it's best to save timestamps, and only convert for display to users.
I didn't know it was Unix format - I can easily convert that in the VB.Net program I'm writing that uses the shopkeeper saved variables. In the VB.Net program I will probably convert it on the fly as I am reading all the values for each sale into a multi-dimensional array (sorted and displayed by the users selections).

I swear I did so many searches to find what format LUA was using - oddly enough I do this all the time with SQL exports to Excel. I should have just assumed.
  Reply With Quote
10/11/14, 03:37 PM   #5
dopiate
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 147
Originally Posted by Garkin View Post
You can try conversion from timetamp here:
http://www.epochconverter.com/

1410642972 = 09/13/2014 @ 21:16:12 UTC
1410643006 = 09/13/2014 @ 21:16:46 UTC
1410643071 = 09/13/2014 @ 21:17:51 UTC

On the same page is also explained how to get timestamp and how to convert it to human readable form.
Wow that's a nice resource - ty for the link!

I can probably just use the vbscript command the show in VB.Net.

it seems simple in hindsight - but I just didn't recognize it as Unix.

Thanks again!

edit: just tested the function that page links and it works perfect!

Function epoch2date(ByVal myEpoch)
epoch2date = DateAdd("s", myEpoch, "01/01/1970 00:00:00")
End Function

Last edited by dopiate : 10/11/14 at 03:55 PM. Reason: it worked great
  Reply With Quote
10/11/14, 04:04 PM   #6
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,305
Hope you don't mind if I hijack this thread, as I also have a question about timestamps that bothers me since a while ago and I haven't had the time to test it yet.
Does anyone know if these timestamps are server time (synced between users) or client time (dependent on the users local settings).
__________________
Like what I do? Support me on Patreon!
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
  Reply With Quote
10/15/14, 03:36 PM   #7
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 648
Originally Posted by dopiate View Post
here are a few example:
1410642972
1410643006
1410643071
is that format convert-able outside LUA - or maybe I can change it to something easier to work with before it hits the saved variables.
As far as converting it before it hits the saved variables there are a few built in functions to allow you to manipulate timestamps, dates & times.

There may be more but I used these in an addon once and had a copy of this info I saved for reference.

Timestamp, date, time functions:
Warning: Spoiler


TimeFormatStyleCodes for the FormatTimeSeconds(..) and FormatTimeMilliseconds(..)
Warning: Spoiler


TimeFormatPrecisionCodes for the FormatTimeSeconds(..) and FormatTimeMilliseconds(..)
Warning: Spoiler


TimeFormatDirectionCodes for the FormatTimeSeconds(..) and FormatTimeMilliseconds(..)
Warning: Spoiler
  Reply With Quote
10/15/14, 03:36 PM   #8
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 648
Originally Posted by sirinsidiator View Post
Does anyone know if these timestamps are server time (synced between users) or client time (dependent on the users local settings).
They are client time.
  Reply With Quote
10/30/14, 02:01 PM   #9
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 500
Originally Posted by circonian View Post
They are client time.
But GetTimeStamp() is UTC. (time-zone independ)
Code:
d(FormatTimeSeconds(GetTimeStamp(), TIME_FORMAT_STYLE_CLOCK_TIME, TIME_FORMAT_PRECISION_TWENTY_FOUR_HOUR, TIME_FORMAT_DIRECTION_ASCENDING) .. " / " .. GetTimeString())
Output:
19:31 / 20:31:49

Which time-zone am I?

If your client clock is desynced too much, you have trouble elsewhere.
Assuming your clock is synced via NTP, the values of GetTimeStamp() from server and client are not synchronous, but close to each other.

Does anyone disagree or can confirm?
__________________
@votan73 (EU - megaserver)
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Time-Date Stamp a mystery

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off