Datastore target hour board

Hey, recently I have learned that trello isnt the best and I should use datastore. I am trying to make a board that displays a time until next training, so I can set a datastore example: On the datastore, I set the session time to the long date “14/04/2022 17:00 BST” and it converts that so on the board it would say "1D, SomethingHs, SomethingMins, SomethingSeconds! If you can’t do it, the long date like that is fine! Btw, this is a surface GUI! | I use DataStoreEditor V3 but idk where to start…

Kinda works like this:

  1. Recieve data from editor
  2. Convert to timezones
  3. Make update function

Thanks!

1 Like

Well do the fist thing to do should be to create a date adder/retriever ysing datastores.

If you know how to make guis then you can use thise and hook it up to a datastore.

For Example:

local DS = game:GetService("DatastoreService"):GetDatastore("Your_Name_Here")

function AddDate(Date,Month,Year,TimeInHour,TimeInMinutes,TimeInSeconds,Key)
local AddTable = {}
AddTable["Date"] = Date
AddTable["Month"] = Month
AddTable["Year"] = Year
AddTable["Hour"] = TimeInHour
AddTable["Minute"] = TimeInMinutes
AddTable["Second"] = TimeInSeconds

local pcallStatus,result = pcall(function()
DS:SetAsync(Key,AddTable)
end
end)

Do you have discord so we can talk this through more?

Well, for a start, using @IamNewToRiblix 's Code to set the date will be helpful and can be integrated into a gui of some sort that provides all of the data requested by the function.

For this, examples of what you would provide to the function are:
13, 04, 2022, 18, 00, 00, “TargetHour”
Im sure you will be familiar with this.

Next, its time to get the current universal or DST times.

In your script, we should start by getting the current UTC time by using DateTime. Then we can add 1 to make it BST. Looking at the documentation, you should end up with this:

-- UNTESTED CODE, DOCUMENTATION USED
local currentTime = DateTime.new()
local utc = tonumber(currentTime.FormatUniversalTime("HH", "en-us")) -- "HH" Returns the current (24 hour) hour value with placeholders (01, 02, etc).
local bst = tonumber(currentTime.FormatUniversalTime("HH", "en-us")) + 1 -- Here we can simply add 1 to make it BST.
-- UNTESTED CODE, DOCUMENTATION USED

Unfortunately, I cannot help further however this could be a starting point for when others reply.

yeah i do.
2nd Step Should be Retrieving data.

-- Consider this After the Above function

function RetrieveDate(Key)
local pcallStatus,Result = pcall(function()
DS:GetAsync(Key)
end
if pcallStatus == true and Result then
return result
else
warn("The Date Wasnt Retrieved Due to a Error (ERROR):"..Result)
end
end)

Next You Convert the Data Into Numerical Format and I Believe @EpsilonDaffy Has Explained it Well Above. Thats all needed i guess now you should hook it all up to a GUI for More Convinience.

You shouldnt rely on that for data. You should you DataStore Service and Use the Editor for Updates to Date.
Talking About time. You use Unix Time.
Lastly for Update just use getasync and u should be good

Im still really unsure how to do this script.