What is the purpose of this DAC?
PX.SM.StandartDateTimeFormat
I used it in a generic inquiry and it displayed the day and time according to my site timezone.
Am I using it correctly? How else can it be used? I’d like to know if anyone is using it.
What is the purpose of this DAC?
PX.SM.StandartDateTimeFormat
I used it in a generic inquiry and it displayed the day and time according to my site timezone.
Am I using it correctly? How else can it be used? I’d like to know if anyone is using it.
Best answer by Hughes Beausejour
It’s used as a base DAC in PXStandartDateTimeFormatSelectorAttribute to return multiple date time patterns.
The selector takes the date time format parameter:
[PXStandartDateTimeFormatSelectorAttribute('D')]
That value is passed as Code parameter to .NET Framework GetAllDateTimePatterns.
The multiple patterns are stored in the PX.SM.StandartDateTimeFormat.Pattern field.
protected virtual IEnumerable GetRecords()
{
if (Cache == null || Cache.Current == null) yield break;
PX.SM.LocaleFormat row = Cache.Current as PX.SM.LocaleFormat;
CultureInfo culture = null;
if (row != null && !String.IsNullOrEmpty(row.TemplateLocale))
culture = CultureInfo.GetCultureInfo(row.TemplateLocale);
if (culture == null) culture = CultureInfo.CurrentCulture;
foreach (String pattern in culture.DateTimeFormat.GetAllDateTimePatterns(Code))
{
yield return new PX.SM.StandartDateTimeFormat() { Pattern = pattern };
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.