How can i add field date-time but only time field ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • binhchay
    Junior Member
    • Aug 2022
    • 11

    How can i add field date-time but only time field ?

    I added field date-time. But i need to only selection hours. I don't need selection date. How can i delete select date ? Thank you so much
  • victor
    Active Community Member
    • Aug 2022
    • 727

    #2
    Hi binhchay,

    Unfortunately, EspoCRM does not have a Time type field, but there is a Date-Time field (screen 1). I have two solutions for you: simpler and more complex.

    Simpler:
    The simple one is that we use a field of type Varchar to set the time. We create it in Administration -> Entity Manager -> Your Entity name -> Fields, display it in Administration -> Layout Manager -> Your Entity name -> Detail and after that, in a new record, we fill in this field as soon as we want.

    More complex:
    - Create two new fields in Administration -> Entity Manager -> Your Entity name -> Fields: one with the type Date-Time and the second with the type Varchar (screen 2), mark this field as read-only;
    - Display our new fields in Administration -> Layout Manager -> Your Entity name -> Detail;
    - Write the following formula Administration -> Entity Manager -> Your Entity name -> Formula (screen 3):

    Code:
    ifThen(
    !onlyTime != true,
    timer = datetime\format(onlyTime, 'Europe/Kiev', 'HH:mm')
    );
    Where (screen 3):
    1 is an attribute of your field with type Date-Time;
    2 is your time zone;
    3 is your time format;
    4 is an attribute of your field with type Varchar.

    - Choose any day and set the desired time in the Date-Time field, and get the result in the Varchar field (screen 4).
    Attached Files

    Comment

    • binhchay
      Junior Member
      • Aug 2022
      • 11

      #3
      Originally posted by victor
      Hi binhchay,

      Unfortunately, EspoCRM does not have a Time type field, but there is a Date-Time field (screen 1). I have two solutions for you: simpler and more complex.

      Simpler:
      The simple one is that we use a field of type Varchar to set the time. We create it in Administration -> Entity Manager -> Your Entity name -> Fields, display it in Administration -> Layout Manager -> Your Entity name -> Detail and after that, in a new record, we fill in this field as soon as we want.

      More complex:
      - Create two new fields in Administration -> Entity Manager -> Your Entity name -> Fields: one with the type Date-Time and the second with the type Varchar (screen 2), mark this field as read-only;
      - Display our new fields in Administration -> Layout Manager -> Your Entity name -> Detail;
      - Write the following formula Administration -> Entity Manager -> Your Entity name -> Formula (screen 3):

      Code:
      ifThen(
      !onlyTime != true,
      timer = datetime\format(onlyTime, 'Europe/Kiev', 'HH:mm')
      );
      Where (screen 3):
      1 is an attribute of your field with type Date-Time;
      2 is your time zone;
      3 is your time format;
      4 is an attribute of your field with type Varchar.

      - Choose any day and set the desired time in the Date-Time field, and get the result in the Varchar field (screen 4).
      Thank you for resolve

      Comment

      Working...