Normal time works, date table does not? Android...

At the time, I was just trying every way I could think of to make it work, and the only way it did, was when I did os.time() * 20.57142857142857 

I also found this following post on a website to work out how to calculate the game time that I need…

To those fellow geeks who would like to know how to calculate Eorzea time based on the local time - take the current time (I’m assuming Epoch format below) and multiply it by 20.57142857142857. As per the above, 1 bell is 3600 Eorzean seconds and 175 Earth seconds, so 3600/175 = 20.57142857142857.

For example, here is what I use in my PHP code:

date_default_timezone_set(‘UTC’); // Use UTC time
print date(“H:i:s”, time()*20.57142857142857); // Provides current Eorzea time

The above post, is where I got the 20.57142857142857 from :) 

This might help explain my problem better, basically, I need to display this time conversion :slight_smile:

http://ffxiv.gamerescape.com/wiki/Time

Are you interested in the time or do you need the date as well?

Just the time, if its easier :) 

okay, what I would suggest then is getting the time stamp for a date in the past that’s not 40 years in the past, like Jan 1, 2010 at midnight.  Then subtract that time in seconds from the current time in sections.  Mulitply that by your constant and either convert that number to your time string needed or if necessary add the the number of seconds back in (though I don’t know that’s really needed).

Rob

Hi Rob,

thanks for the information. I think I understand what you’re saying, but I am a little confused about the subtraction from sections part. What do you mean by sections? Thanks :slight_smile:

EDIT: 

Is this what you meant, Rob? 

-- Get the date of Jan 1, 2010 local now = os.date("\*t") local jan = os.date("\*t", 1262304000) local hour =now.hour - os.time(jan) local min = now.min - os.time(jan) local sec = now.sec - os.time(jan) print(hour)

No, more like:

local jan = os.time( { year=2010, month=1, day=1, hour=0, min=0, sec=0 } ) local now = os.time() local  eorzean = (now - jan) \* 20.57142857142857 + jan local date = os.date( "\*t", eorzean ) print(date.hour .. ":" .. date.min)

You may not need to add the “+ jan” value back in.  I’m not sure.

Rob

Hi Rob, thanks for the reply. Unfortunately, the above code didn’t get the correct time. The current time in-game can be seen from this website: http://www.ffxivclock.com/#/

I tried with the + jan and without it. 

I don’t know whether this would be easier or not, but would it be possible for Corona to read a .PHP file on the web? and display the time that way? I’m not sure how complicated that would be 

If there is a php script that does what you want, you can use network.request() to fetch the file.

Rob