Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    incorrect date formatting using 12 hours

    Hi,

    Date formatting using
    Code:
    DateUtil.format(date, 'hh:mm a')
    method, formats it with the hours begin from 0 AM to 12 pm. According to SimpleDateFormat java API [1], "h" stands for "Hour in am/pm (1-12)".

    Example:

    Code:
    console.log(isc.DateUtil.format(new Date('Wed Jan 07 2015 00:00:00'), 'hh:mma'));
    console.log(isc.DateUtil.format(new Date('Wed Jan 07 2015 12:00:00'), 'hh:mma'));
    logs

    Code:
    00:00 am
    12:00 am
    whereas equivalent code in Java:

    Code:
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        System.out.println(new SimpleDateFormat("hh:mm a").format(sdf.parse("00:00")));
        System.out.println(new SimpleDateFormat("hh:mm a").format(sdf.parse("12:00")));
    logs:
    Code:
    12:00 AM
    12:00 PM

    Tested with ISC_100_BRANCH_2015-01-19_1421661957_wayne_limegreen-dev-server


    [1] http://docs.oracle.com/javase/7/docs...ateFormat.html

    #2
    We've made changes to address this issue via DateUtil.format() and in Calendar eventEditors. You can test the changes in builds dated February 2 and later.

    Comment


      #3
      Smart Client version: v9.1p_2015-10-07/Pro Deployment (built 2015-10-07)

      When the date being passed through has 12 in the hour, it is always set to AM regardless with the "MM/dd/yyyy h:mma" format string on a specific field. The issue looks similar to the issue that started this thread. I was just curious if the formatting was fixed in the front end code as well, or if I should be using something else.

      List Grid
      Code:
      fields: [{
                  name: "timestamp",
                  title: "Date",
                  width: 120,
                  canEdit: false,
                  canGroupBy: false,
                  format: "MM/dd/yyyy h:mma",
              }]
      Data Source
      Code:
      <fields>
          <field name="timestamp" title="Date" type="datetime" />
      </fields>
      Example:
      Shows up with 03/12/2016 12:38am when it should be 03/12/2016 12:38pm

      Comment


        #4
        The changes that fixed the original issue were only ported as far back as 10.0 - they didn't get to 9.1.

        We've made those changes now in 9.1, so you can retest with tomorrow's build, dated March 23.

        We expect your problem to be resolved, but if you still see issues, please post a minimal, standalone test-case that we can run, and any specific steps to recreate.

        Comment

        Working...
        X