Originally Posted by dopiate
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
Lua Code:
GetDateStringFromTimestamp(integer timestamp)
Returns: string dateString
GetTimeString()
Returns: string currentTimeString
GetDate()
Returns: integer currentTime
GetTimeStamp()
Returns: id64 timestamp
GetDiffBetweenTimeStamps(id64 laterTime, id64 earlierTime)
Returns: number difference
GetFormattedTime()
Returns: integer formattedTime
GetGameTimeMilliseconds()
Returns: integer gameTimeInMilliseconds
GetSecondsPlayed()
Returns: integer secondsPlayed
GetSecondsSinceMidnight()
Returns: integer secondsSinceMidnight
FormatTimeSeconds(number timeValueInSeconds, TimeFormatStyleCode formatType, TimeFormatPrecisionCode precisionType, TimeFormatDirectionCode direction)
Returns: string formattedTimeString, number nextUpdateTimeInSec
FormatTimeMilliseconds(integer timeValueInMilliseconds, TimeFormatStyleCode formatType, TimeFormatPrecisionCode precisionType, TimeFormatDirectionCode direction)
Returns: string formattedTimeString, integer nextUpdateTimeInMilliseconds
TimeFormatStyleCodes for the FormatTimeSeconds(..) and FormatTimeMilliseconds(..)
Warning: Spoiler
Lua Code:
TIME_FORMAT_STYLE_CAST_TIME
TIME_FORMAT_STYLE_CHANNEL_TIME
TIME_FORMAT_STYLE_CLOCK_TIME
TIME_FORMAT_STYLE_COLONS
TIME_FORMAT_STYLE_COOLDOWN_TIME
TIME_FORMAT_STYLE_DESCRIPTIVE
TIME_FORMAT_STYLE_DESCRIPTIVE_SHORT
TIME_FORMAT_STYLE_DESCRIPTIVE_SHORT_SHOW_ZERO_SECS
TIME_FORMAT_STYLE_DURATION
TIME_FORMAT_STYLE_RELATIVE_TIMESTAMP
TIME_FORMAT_STYLE_SHOW_LARGEST_UNIT
TIME_FORMAT_STYLE_SHOW_LARGEST_UNIT_DESCRIPTIVE
TIME_FORMAT_STYLE_SHOW_LARGEST_UNIT_DESCRIPTIVE_COLOR
TIME_FORMAT_STYLE_SHOW_LARGEST_UNIT_DESCRIPTIVE_SHORT
TimeFormatPrecisionCodes for the FormatTimeSeconds(..) and FormatTimeMilliseconds(..)
Warning: Spoiler
Lua Code:
TIME_FORMAT_PRECISION_SECONDS
TIME_FORMAT_PRECISION_TENTHS
TIME_FORMAT_PRECISION_TENTHS_RELEVANT
TIME_FORMAT_PRECISION_TWELVE_HOUR
TIME_FORMAT_PRECISION_TWENTY_FOUR_HOUR
TimeFormatDirectionCodes for the FormatTimeSeconds(..) and FormatTimeMilliseconds(..)
Warning: Spoiler
Lua Code:
TIME_FORMAT_DIRECTION_ASCENDING
TIME_FORMAT_DIRECTION_DESCENDING
TIME_FORMAT_DIRECTION_NONE