Acumatica Date Time Specifiers

 Hello everybody,

today I want to describe some date time specifiers in acumatica.

d - is default format pattern, so if you intend to use short date pattern, you can just ommit pattern in usage function

public static System.Text.StringBuilder MakePattern(string format, System.Globalization.DateTimeFormatInfo df)

D - long date pattern. Something similar to "Thursday, April 10, 2008"

F - long time pattern. Full date/time pattern. Something similar to "Monday, June 15, 2009 1:45:30 PM".

G - long time pattern. General date time pattern. Something like  "6/15/2009 1:45:30 PM" for "en-US" or "2009/6/15 13:45:30" for zh-CN

M equals to m and means Month day pattern "June 15"

R equals to r - RFC 1123 pattern. The custom format string is "ddd, dd MMM yyyy HH':'mm':'ss 'GMT' like "Mon, 15 Jun 2009 20:45:30 GMT"

T - long time pattern. "1:45:30"

U - long time pattern. Universal full date/time pattern. "Monday, June 15, 2009 8:45:30 PM" or "den 15 juni 2009 20:45:30" ( for sv-SE )

s - sortable date time pattern. Intended for sorting as strings. Format: "yyyy'-'MM'-'dd'T'HH':'mm':'ss". Looks like "2009-06-15T13:45:30"

t - short time pattern. 1:45 PM ( for en-US ), "13:45" ( hr-HR )

u - universal sortable date time pattern. 2009-06-15 20:45:30Z. Also for sorting as string.

y equals to Y year month pattern. Looks like June, 2009

f - short time pattern. Similar to "Monday, June 15, 2009 1:45 PM". Differs from 'F' by ommiting seconds

g - short time pattern ( at least in code ), and looks like this:

case 'g':
                    builder.Append(df.get_ShortDatePattern()).Append(' ').Append(df.get_ShortTimePattern());
                    return builder;

I was surprised because here g stands for "General date/time pattern" or  "6/15/2009 1:45 PM" while in acumatica 'g' is equal to 'f'

9 Comments

  • Bob said 

    This tells me absolutely nothing about how to use DateTime specifiers. I have no idea what this is even supposed to be.

  • docotor said 

    Hello Bob,
    thank you for your comment.
    I read again, and suppose you look for this:

    #region StatementDate
    public abstract class statementDate : PX.Data.IBqlField
    {
    }
    protected DateTime? _StatementDate;
    [PXDBDate( InputMask = "your input mask", DisplayMask = "your display mask")]
    [PXDefault]
    [PXUIField(DisplayName = "Statement Date")]
    public virtual DateTime? StatementDate
    {
    get
    {
    return this._StatementDate;
    }
    set
    {
    this._StatementDate = value;
    }
    }
    #endregion

  • docotor said

    Take notice of
    [PXDBDate( InputMask = "your input mask",
    DisplayMask = "your display mask")]

    hope it helps

  • adithar said

    I have a problem about date time.
    in acumatica standard date time if Timesmode = true
    format in screen = 00:00 AM/PM
    how to make datetime formats are second For example = 00:00:00

    thank you

  • docotor said

    I suppose that with TimesMode = true you'll not be able to achieve this.

  • adithar said

    what things must be done to achieve that format?

  • mungalim said 

    I need the help of the problems in Acumatica.
    I made the Date Time format in the database, and I set the DAC filed PXDBDateAndTime becomes
    [PXDBDateAndTime(InputMask = "dd-MM-yyyy HH:mm:ss",
    DisplayMask = "dd-MM-yyyy HH:mm:ss")]
    ,,,
    inside page already appears 20-04-2016 10:30:15,
    but for seconds can not be entered into the database, How solution when seconds can be saved to the database,,?

    thanks, waiting for reply

  • docotor said 

    So, you modify seconds at client side ( in browser ) , but those changes doesn't go to db ?

Comments are closed