I have a few places where I need to change how the date format displays in my Alfresco share:
Calendar Format
Needs to be in MM/DD/YYYY format.
Date in Info.ftl Control
Needs to be in DDD MM DD YYYY format.
Date().toString()
This is being displayed in a data list. Ideally it should read: "Tue Jul 2015 8:27:51 (EST)"
I located common.properties and made the following changes:
## Date Formats
#Used client side (uses Alfresco.util.formatDate)
date-format.default=mmm ddd d yyyy HH:MM:ss
date-format.defaultDateOnly=mmm ddd d yyyy
date-format.shortDate=m/d/yy
date-format.mediumDate=mmm d, yyyy
date-format.mediumDateNoYear=mmm d
date-format.longDate=mmmm dd, yyyy
date-format.longDateNoYear=mmmm dd
date-format.fullDate=mmmm, d dddd, yyyy
date-format.fullDateTime=mmmm, d dddd, yyyy 'at' h:MM TT
date-format.shortTime=h:MM TT
date-format.mediumTime=h:MM:ss TT
date-format.longTime=h:MM:ss TT Z
date-format.monthYear=mmmm yyyy
date-format.dayDateMonth=mmmm, d dddd
date-format.am=am
date-format.pm=pm
But none of them seem to affect any date formats anywhere. My questions:
Where do I need to make additional changes to get the above formats to work?
How do I change the time zone?
Essentially, I need to change everything to Eastern US time zone and formats.
Different files where date format are mentioned. Each of them are responsible for rendering dates in different places
<ALF_HOME>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\form\form.get_en.properties
<ALF_HOME>\tomcat\webapps\share\WEB-INF\classes\alfresco\messages\common.properties
<ALF_HOME>\tomcat\webapps\share\WEB-INF\classes\alfresco\messages
common.properties\slingshot.properties
We need to edit the \tomcat\webapps\share\WEB-INF\classes\alfresco\messages\common.properties as well as \tomcat\webapps\share\WEB-INF\classes\alfresco\messages\common_en.properties the second file the locale specific file should also be modified.
Modify the below key's value
date-format.default=mm/dd/yyyy
These changes only impact the display format of date, if we need to make changes for form we need to modify in \tomcat\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\components\form**form.get_en.properties** and form.get.properties.
Hope this will help you :)
Related
Kibana 7.10.2. Trying to shape #timestamp only for a specific visualization where I would like to have YY MMM dd ddd format (instead of the UTC defined in settings).
Tried using Scripted Fields but it's not working when I use my scripted field in the data histogram visualization.
Error when using scripted field in visualization
Scripted field image
Any hints?
Thanks!
You can create a scripted field such that:
name: (e.g.) custom-timestamp
language: painless
type: date
format: Date
format pattern: YY MMM d, ddd
Script: doc['#timestamp'].value
I have a sensor log file with dates in the form Mon Nov 30 18:21:40 UTC 2020 that I'd like to convert to OpenRefine dates.
Per GREL Date Functions, I thought the correct transformation would be value.toDate('E M d H:m:s z y'), but I consistently get "Error: Unable to convert to a date".
I've tried simple things like replacing UTC with GMT, without success.
What clue am I missing?
That's a weird date format. I'm not sure why a sensor log wouldn't just use ISO 8601.
Try using value.toDate('EEE MMM d H:m:s Z y').
It's not super obvious from the docs that you need multiple characters, but if you look at the examples at the bottom of this page, you can see them used there.
https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
When generating date formats from a template with Foundation's DateFormatter for the Locale "de", like this:
let locale: Locale = Locale(identifier: "de")
let format = DateFormatter.dateFormat(fromTemplate: "dMMMyGhhmmss",
options: 0,
locale: locale)
I always get this format:
d. MMM y G, h:mm:ss a
which renders
17. Nov. 2018 n. Chr., 8:30:20 PM
The 'PM' part is unusual for Locale "de", but it is my understanding that this method also takes user preferences into account. Is that correct?
I played around with the settings in System Preferences, e.g. switching to 24-hour clock, but nothing I changed had any effect. Do I have to restart something for the changes to take effect?
Can someone explain to me what's going on?
If you use h or H in the template, the format will contain the specified hour format (12-hour or 24-hour), regardless of the locale. Use j instead. This symbol requests the preferred hour format for the locale.
For example, given the template dMMMyGjjmmss, I get:
MMM d, y G, h:mm:ss a (12-hour format) for locale "en"
d. MMM y G, HH:mm:ss (24-hour format) for locale "de"
Apple's documentation states:
The format string uses the format patterns from the Unicode Technical Standard #35.
The Unicode Technical Standard #35 has this to say about the symbol j:
This is a special-purpose symbol. It must not occur in pattern or skeleton data. Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation. In such a context, it requests the preferred hour format for the locale (h, H, K, or k), as determined by whether h, H, K, or k is used in the standard short time format for the locale. In the implementation of such an API, 'j' must be replaced by h, H, K, or k before beginning a match against availableFormats data. Note that use of 'j' in a skeleton passed to an API is the only way to have a skeleton request a locale's preferred time cycle type (12-hour or 24-hour).
I have date in format 2009-02-07T15:23:00Z which needs to be converted to the format Mmm DD, YYYY in xslt.
How to achieve this? I have tried using <xsl:value-of select="format-dateTime()"/>
But not getting any output may be due to some mistake which i am not bake to figure it out.
Please let me know how this can be achieved?
Worked using xsl:choose and substring(date, 9, 2).
I have this date and time format:
2010-05-19 07:53:30
and would like to change it to:
Wednesday # 7:53PM 5/19/2010
I'm doing this, which gets the current format:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = #"yyyy-MM-dd HH:mm:ss";
but when I change the format, I end up with a null. For example:
formatter.dateFormat = #"hh:mm tt MM-dd-yyyy";
date = [formatter stringFromDate:formattedDate];
date will be null. I want to put the end result into an NSString. It would be nice if time and date could come out as separate properties so I can arrange them however I like. Any ideas on how I can change the formatting?
I think your formatting string is the problem. You should only use the characters you find in the table in UTS#35 Date Format Patterns. I tried your code and while the time hh:mm displays correctly, formatting stops at tt - not in the table!
If you really want characters in the format string that are not in the table you can escape them, like hh 'o''clock' a, zzzz - produces format like "12 o'clock PM, Pacific Daylight Time".
It would be nice if time and date could come out as separate properties so I can arrange them however I like. Any ideas on how I can change the formatting?
You have things backwards. If this is a date/time to be displayed to the user, you need to present it how the user wants it, not how you want it. For instance, most people outside the USA will be confused by MM-dd-yyyy particularly if the day is less than 13. Consider using -setDateStyle: and -setTimeStyle:. That way, the display string will come out as the user expects.