PtokaX forum

Development Section => LUA & PtokaX-Scripting-Interface => Topic started by: merlin_xl54 on 04 August, 2008, 21:18:28

Title: Julian Dates
Post by: merlin_xl54 on 04 August, 2008, 21:18:28
Hi,

I've noticed that some script refer to a Julian date. Is there an easy way to understand this in regards to Ptokax & Lua? I use a script "Top Hubbers" which sets a date on first connect to a table. Example below. Is there a way to determine this as a Day Month Year format?

["Julian"] = 1216309474,

Tia,

M
Title: Re: Julian Dates
Post by: bastya_elvtars on 04 August, 2008, 22:49:32
Yes. This is the number of seconds passed since 1st January 1970 00:00:00 (which is the smallest possible date for Lua amongst others). You should be able to count this.
(Moved to the appropriate forum.)
Title: Re: Julian Dates
Post by: Yada on 05 August, 2008, 14:33:17
well Thats is not really Julian Date that, it's Unix Time.

It's more like this:

Julian Date (JD) had it's Epoch BC 4713-01-01 12:00, Monday
The JC date for 2008 August 5 00:00:00 UT is 2454683.24125 days
And the Chronological Julian Day (CJD) is JD + 0.5 = 2454684 (with 0.5 representing midnight Universal Time)

And Unix time in seconds from it's Epoch 1970-01-01, Thursday
The Unix time for UTC (Coordinated Universal Time) 2008 August  5 00:00:00 is 1217894400 seconds

There is a ton of converters online and some nice scripts here in this forum that converts to Day Month Year format
Title: Re: Julian Dates
Post by: Jorgo on 05 August, 2008, 15:54:21
Actually, that was when Julian dated Jenny, somewhere in the summer of '69. It's somewhat of a rough timeframe but for a nerd it was like the eigth wonder of the world. Henceforth he wrote Julian Dates Jenny in Capitals, but when Jenny left him, just Julian Dates remained to mark the monumental affair.
Title: Re: Julian Dates
Post by: merlin_xl54 on 05 August, 2008, 16:02:22
Quote from: Yada on 05 August, 2008, 14:33:17

There is a ton of converters online and some nice scripts here in this forum that converts to Day Month Year format

Thanks.... That was what I needed. I found one online.

M
Title: Re: Julian Dates
Post by: Thor on 05 August, 2008, 16:11:02
os.date() can format you: http://www.lua.org/manual/5.1/manual.html#pdf-os.date
eg. use os.date("%Y %B %d %H:%M:%S",1217894400) will result 2008 August 05 00:00:00. You can use the same variables as in C.