Time format on saveslots

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Karrion
Regular
Posts: 73
Joined: Fri Jan 18, 2019 8:33 pm
Projects: Murder on the Marine Express
Organization: 1564 Studio
itch: 1564-studio
Contact:

Time format on saveslots

#1 Post by Karrion »

I want to have the time in the saveslots as the format "MON 16.11.1952", however I can't find anywhere in the documentation how can I put the day in uppercase and just the first 3 letters (I tried using !u as it said it could force uppercase and didn't work), or how can I put the month in number instead of letters. Any help is appreciated.
1564 Studio, an indie studio dedicated to developing mystery VNs!
Follow us on Twitter for updates on our projects!

Image

Check out our current project, just released on PC, Android, Switch, XBox ONE/Series S/X and PS4/5!
Also available in Spanish, English, French and Japanese!

Image

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Time format on saveslots

#2 Post by namastaii »

In screens.py under screen file_slots change this line to this (it's on line 648 if you haven't added anything to this page)

Code: Select all

text FileTime(slot, format=_("{#file_time}%a, %m.%d.%Y, %H:%M"), empty=_("empty slot")):
%a changes it to the short version of the month and put periods in between the month, day, year, also changing it to %m for the month number version. Here's a reference for these https://www.w3schools.com/python/python_datetime.asp

Though, I'm not sure the best way to make the weekday all caps. I don't think renpy already has certain libraries you'd use for this? I tried .upper() as well and it didn't seem to change it. Maybe someone else has a suggestion. Though, if you're willing and it's important enough, you can do some extra steps to make this happen but this code I wrote up gives this outcome:
timeformatexample.jpg
timeformatexample.jpg (3.49 KiB) Viewed 371 times
Also, you can easily remove the commas if you wanted it to look just like your example which doesn't include those.

User avatar
Karrion
Regular
Posts: 73
Joined: Fri Jan 18, 2019 8:33 pm
Projects: Murder on the Marine Express
Organization: 1564 Studio
itch: 1564-studio
Contact:

Re: Time format on saveslots

#3 Post by Karrion »

Ah, yes, thank you! I was looking for format options and couldn't find anything in the ren'py documentation. The all-caps thing is not important so we'll just leave it as-is.
1564 Studio, an indie studio dedicated to developing mystery VNs!
Follow us on Twitter for updates on our projects!

Image

Check out our current project, just released on PC, Android, Switch, XBox ONE/Series S/X and PS4/5!
Also available in Spanish, English, French and Japanese!

Image

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Time format on saveslots

#4 Post by namastaii »

Yeah anything with stuff like this, you might find more info by looking up python documentation since this just has to do with time formatting in python :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]