How to change this CUBA date time type to LocalDateTime

Hi everyone,

I retrieved data from database and It is in the form of CUBA date time. Something like this ‘Wed Jan 05 02:00:00 SGT 2022’. I want to change this CUBA date time to LocalDatetime in “DD:MM:YYYY”. Please help me and do not remove my post.

Regards.

Hi,

  1. first inject an object called dateformatter
    @Inject
    private DatatypeFormatter datatypeFormatter;
  2. use post-defined method of dataformatter
    datatypeFormatter.formatDate(your_variable);
    please noted that your_variable should be in Date type.

Regards,

Hi,

cool solution. How do I get day only from the date datatype. For example: my date data type is like this ‘2/3/2021’ and I want my result to be THU. Please help me.

Regards,