SageTV Community

SageTV Community (
-   SageTV Studio (
-   -   How to display Date as MM/dd/YY (zero pad) (

graywolf 01-04-2021 01:00 PM

How to display Date as MM/dd/YY (zero pad)
In Studio, I have:
DateFormat("MM/dd/yy", StartTime)

It is displaying dates like 12/1/20 and 1/3/21 but I want it to be 12/01/20 and 01/03/21

Per the API it says:
public java.lang.String DateFormat(java.lang.String Format,
java.lang.Object Date)
Returns a formatted date string for the specified Date.
Format - null if SageTV's default date format should be used, otherwise use a formatting string as specified in java.text.SimpleDateFormat
Date - either a java.util.Date object or a long which corresponds to the date
the date formatted string

From my understanding, SimpleDateFormat is suppose to be displaying MM/dd/yy as 12/01/20, 01/03/21, etc

What am I missing?

wnjj 01-04-2021 10:56 PM

I looked into the DateFormat code and there's special handling in there for localization:


// Replace M/d with the appropriate representation for this Locale
In the code (, it uses a regular expression to match on M or MM followed by /, followed by d or dd and replaces it with a localized version using java.text.DateFormat.SHORT.

I don't claim to understand all of this completely but it's possible that what you are trying to do won't work.

graywolf 01-05-2021 07:01 AM

Thanks. That explains it.
Changing to MM-dd-yy works to have the padded zeros i.e. 12-01-20 and 01-03-21

All times are GMT -6. The time now is 07:26 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.