RPG Maker Times

Smile Game Builder and RPG Maker Tutorials, Plugins, Resources, Windowskins

Time/Date Formats

EDIT: This tutorial will be moving to Scripts Tutorials and updated soon.

In yesterday’s entry, System Time/Date Script, I showed how to use the built-in Time function to display the current (system) time and date.

To change format, the strftime method has a number of options available.

Its basic format is

strftime(format)

where format is the format string to be used, which may be specified with the following:

  • %A – Full day of the week (Sunday, Monday, etc.)
  • %a – Abbreviated day of the week (Sun, Mon, etc.)
  • %B – Full month (January, February, etc.)
  • %b – Abbreviated month (Jan, Feb, etc.)
  • %c – Current Date and Time (system clock format)
  • %d – Day of the month (01-31)
  • %H – Time of day in 24-hour format (00-23)
  • %I – Time of day in 12-hour format (01-12)
  • %j – Day of the year (001-366)
  • %M – Minutes (00-59)
  • %m Numerical month of the year (01-12)
  • %p – Displays AM or PM after the time
  • %S – The number of seconds (00-60, 60 being a “leap second”)
  • %U – Week of the year, the first week starting with the first Sunday (00-53)
  • %W – Week of the year, the first week starting with the first Monday (00-53)
  • %w – Day of the week (0-6, 0 denoting Sunday)
  • %X – Displays the Time
  • %x – Displays the Date
  • %Y – Displays the Year as a 4-digit number (2009)
  • %y – Displays the Year as a 2-digit number (00-99)
  • %Z – Displays the default (system) Time Zone
  • %% – Displays a % character

Note that this is case sensitive.

So, as an example, to display the full date, including day, month and year, strftime would be set to:

strftime = (“%A, %d %B, %Y”)

The result would be

Tuesday, 20 May, 2009

And that’s it!

5 thoughts on “Time/Date Formats

  1. Hello! My name is Irene.
    This script is wonderful!
    Please, could you help me modifying some aspects of it? I’d like to hange the name of the months to my own names (example, february could be called “Beautiful month” :P) and the year, so they wouldn’t the the real month and year? I’m sure it would be very easy for you to do it. But if you dont want to, its ok, no worries. Thank you very much!

  2. Just a question… is it in anyway possible to import these format settings into text windows? like say there was a clock and when you push action button it says (insert time here). If there is that would be awesome.

Categories

Archives

Hi-Tex House Pack Vol. 1

For Smile Game Builder

The Hi-Tex House Pack Vol. 1 contains 297 assets: 284 house wall terrains and 13 models. Get your copy for only $5!

Sponsored Ad

Sponsored Ad


Follow me on Twitter

© 2008-2018, Companion Wulf. All Rights Reserved.