Solved

What is the purpose of this DAC: PX.SM.StandartDateTimeFormat

  • 23 November 2020
  • 1 reply
  • 53 views

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. 

 

 

icon

Best answer by Hughes Beausejour 23 November 2020, 17:17

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 };
    }
}

View original

1 reply

Userlevel 3

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 };
    }
}

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved