With local dateTimeDate = DateTime.now():FormatUniversalTime("L", "en-eu")
i can get the UTC Date, like 10.01.2023, but with TimeZone +1 i have now 11.01.2023, how can i convert UTC to +1?
Get the UnixTimeStamp by reading DateTime.UnixTimeStamp and add whatever number of seconds to convert time zones. Then feed that into DateTime. fromUnixTimestamp() to get the DateTime value for that specific timezone.
Is that right?
local dateTimeDate = DateTime.now().UnixTimestamp
local finalDateTimeDate = DateTime.fromUnixTimestamp(dateTimeDate)
print(finalDateTimeDate)
I dont know how to do this here
local dateTimeDate = DateTime.UnixTimestamp
local finalDateTimeDate = DateTime.fromUnixTimestamp(dateTimeDate+3600)
print(finalDateTimeDate)
It gives a red line Error at DateTime.UnixTimestamp
Mind asking what it says please?
ServerScriptService.DateAndTimeServerScript:23: attempt to perform arithmetic (add) on nil and number
Sorry about that, assumed Roblox’s Engine reference would actually be accurate.
Replace that line with this… how does that do?
local dateTimeDate = os.time()
Sorry, the first line of your code was accurate. This is what it should look like.
local dateTimeDate = DateTime.now().UnixTimestamp
local finalDateTimeDate = DateTime.fromUnixTimestamp(dateTimeDate+3600)
print(finalDateTimeDate) --This will be the Unix time adjusted for timezones
And what do i need to do with 1673399579000
now to get the Date?
I need it to be the 1+ Timezone for all Players in the Server
You can get the operating system’s date and clock with os.date()
Then it will reply with normal text, such as Wed Jan 11 20:07:02 2023
Something like this
local Hours = 1
print(DateTime.fromUnixTimestamp(DateTime.now().UnixTimestamp + 3600 * Hours):FormatUniversalTime("LT", "en-us")) -- prints it in with 1 hour offset