#get time independent of server acrivity
85 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
https://stackoverflow.com/questions/5175728/how-to-get-the-current-date-time-in-java
probably best solution
But that is java....
ye
So ill have to make a mod just to get the time?
bruh dont tell me you didnt know
mostly because like 90% of scripts use it here
imports the class so you can use its methods
Can you give me an example to look at?
[Quote ➤](#1078321791375781909 message) Doesn't require any addons, place outside of events in startup
const $EventBuses = Java.loadClass('dev.architectury.platform.forge.EventBuses')
const $GasDeferredRegister = Java.loadClass('mekanism.common.registration.impl.GasDeferredRegister')
const $SlurryDeferredRegister = Java.loadClass('mekanism.common.registration.impl.SlurryDeferredRegister')
const $InfuseTypeDeferredRegister = Java.loadClass('mekanism.common.registration.impl.InfuseTypeDeferredRegister')
const GASES = new $GasDeferredRegister('kubejs')
const SLURRY = new $SlurryDeferredRegister('kubejs')
const INFUSETYPE = new $InfuseTypeDeferredRegister('kubejs')
GASES.register('example_gas', 0xA020F0)
SLURRY.register('example_slurry', builder => builder.color(0xA020F0))
INFUSETYPE.register('example_infuse_type', 0xA020F0)
GASES.register($EventBuses.getModEventBus('kubejs').get())
SLURRY['register(net.minecraftforge.eventbus.api.IEventBus)']($EventBuses.getModEventBus('kubejs').get())
INFUSETYPE.register($EventBuses.getModEventBus('kubejs').get())
#1048591172165189632
don't we have Date.now() ? I think Rhino makes this available
if there is, its unknown to me
Ye thanks a lot
??index
Please close your ticket (with </ticket close:1054771505520717835> or the button atop this thread) once you resolved your issue! This also helps others that would like to help out, as they don't have to look into this thread to check if it has been resolved by now.
Do you have any other questions regarding your issue? Feel free to ask!
Note: You generally should create a new post for unrelated issues.
I just leave it open until I have time to test it
don't worry ill close it once I did that
??index
Please post how you solved your issue. Others may find this ticket later, but then have to create another because the actual solution wasn't mentioned. thanks <3
Ok
ok?
I will do that
Anyways, console.logging Date.now() returns this 1.699943804428E12
what did you expect?
^
Like 14.11.2023
lol
did you even read the jsdoc
you need to firmat that bri
lol
I know this isn't possible but hoping is allowed right
Is there like a method .day or so
??tryitandsee
autocomplete exists
It suggests NOTHING other than .toFixed .toPrecision
what type does it even return
does the Date object have any static methods?
Nah
yes it does
Oh wait it does
Ill just do this /1000/60/60/24
And then math.floor it
I only need the day
Ticket closed!
Date(Date.now()).getDay() ?
Nah
[07:54:07] [ERROR] ! tycoon.js#1393: Error occurred while handling event 'ServerEvents.tick': TypeError: Cannot find function getDay in object Tue Nov 14 2023 07:54:07 GMT+0100 (CET).
riperino, javadoc says it is deprecated, but wasn't sure about Rhino implementation
what does probejs suggests instead of .getDay() stuff?
wtf looks like that is already a string not like a Date object/class
not useful, Rhino bad
Bruh
or simlply, use unix time?
Wdym? How?
I mean I already got the time in milliseconds, I would need days
🤔 milliseconds / 1000 / 60 / 60 / 24
Yeah but I will have to math.floor this and stuff
So if my math understanding is right, the day will be considderd "over" at 12 o'clock
because js doesn't have a // b, so...```js
const getQuotient = (a, b) => a - a % b
Yeah thanks

