SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-04-2021, 01:00 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
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:
DateFormat
public java.lang.String DateFormat(java.lang.String Format,
java.lang.Object Date)
Returns a formatted date string for the specified Date.
Parameters:
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
Returns:
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?
Reply With Quote
  #2  
Old 01-04-2021, 10:56 PM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,514
I looked into the DateFormat code and there's special handling in there for localization:

Quote:
// Replace M/d with the appropriate representation for this Locale
In the code (https://github.com/google/sagetv/blo...lity.java#L249), 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.
__________________
Windows Installer
Reply With Quote
  #3  
Old 01-05-2021, 07:01 AM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Thanks. That explains it.
Changing to MM-dd-yy works to have the padded zeros i.e. 12-01-20 and 01-03-21
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting based on released date and add to library date not working still Gustovier Diamond 35 03-15-2011 12:45 PM
How to Display Recordings by Recording Date & Original Air Date joe123 SageTV Customizations 25 02-16-2010 05:28 AM
Locale setting (date display) on HD200? MrFusion SageTV Media Extender 0 10-18-2009 08:06 AM
HD200 date/time display glitch troycheek SageTV Beta Test Software 6 05-24-2009 05:34 PM
SageTV display cutoff using secondary display chrishallowell SageTV Software 1 02-09-2008 08:44 AM


All times are GMT -6. The time now is 11:16 AM.


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