Time("year") returns 119 instead of 2019

… as the topic title states. How do i use getFullYear() instead of getYear()?
The getYear method apparently returns the year minus 1900. Trying to make a customizable time system for day/night cycle.

1 Like

why don’t you just add 1900 to getYear() ?

Doing that at the moment, but it’s not preferable. For example, i presently need to do a +1 to call Month as well to get the correct month.

:thinking: Maybe it uses 0 to 11 to represent the month that’s why you have to add 1, is something quite common in computer programming, mainly in C language.

This is because it’s following C programming language conventions. I admit it’s a bit odd, but if I change this now, I’ll break existing games relying on this convention :confused:

1 Like

@4ian Oh no it’s fine.
@xisco Indeed.

Guys, is there a way for me to call Time(“hour”) in a 24 hour format? I just realized that i can’t do a meridiem conversion if i can’t set a 24 hour clock base.

edit: Disregard my question. Time(“hour”) is already in a 24 hr format. Thanks 4ian & xisco.

Or…could implement expressions that return the current year, current month and current day as number for convenient and just remove the current method from the list or flag it as “deprecated” so old projects won’t break, it would be there but only hidden and then you could every 6-12 months or so remove hidden, deprecated functions to clean the code or rename them in case you prefer to keep it because they do provide some useful functionality.

I mean in order to improve things sometime you must break it but you can do it gently and give time for people depends on the old code to adjust and switch to the new and then maybe have a “maintenance release” every 6-12 months or so that actually going to break it because you remove the clutter and deprecated code.
6-12 months should be enough for anyone to adjust and switch to the new functions. If you don’t use GD for 6-12 months it doesn’t matter because then you don’t have an active project so there is nothing to break.

It would be my reply in general for any concern regarding breaking compatibility with old projects in order to improve something.

4 Likes