Results 1 to 6 of 6

Thread: Show datetime values with seconds

  1. #1
    sorrentinov is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    12

    Default Show datetime values with seconds

    Hi All,

    I need to show in ListView and in a subpanel for a particular module a datetime formatted as d/m/Y H:i:s
    In config.php I set

    'default_date_format' => 'd/m/Y',
    'default_time_format' => 'H:i'

    that means I use in any modules I show the datetime fields without seconds.
    Is possible to apply the format only in a particular field/module with seconds?

    Thanks in advance
    Vincenzo

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Show datetime values with seconds

    Hi, Vincenzo

    I believe you have to modify the method fill_in_additional_list_fields in the module class, but this customization is not upgrade safe.

    Cheers

    --
    André Lopes
    Lâmpada Global Services
    Rua Bela Cintra, 299 conjunto. 51
    São Paulo, SP 01415-000
    tel1. 55 11 3237-3110
    cel. 55 11 7636-5859
    e-mail: info@lampadacrm.com.br

  3. #3
    dlorenzetti's Avatar
    dlorenzetti is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    São Paulo, Brasil
    Posts
    189

    Default Re: Show datetime values with seconds

    Hi Vincenzo and Andre

    Modifying the method "fill_in_additional_list_fields", the changes have efects only in ListView, to format the fields in Subpanel and ListView you can modify the method "get_list_view_data".

    Cheers
    Diego Lorenzetti
    Lampada Global Services - Open Source Solutions
    Phone: +55 11 3237-3110
    Email: equipe@lampadaglobal.com
    Site: www.lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

  4. #4
    sorrentinov is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    12

    Default Re: Show datetime values with seconds

    Thx a lot lorenzetti,

    I'd like to know how I can modify get_list_view_data() function becouse if I have default_time_format = 'H:i' I already receive a date formatted and I don't know what are the seconds.

    function get_list_view_data()
    {
    $the_array = parent::get_list_view_data();

    //$the_array['date_modified'] = '09/10/2008 09:56' <---- already formatted without seconds

    $the_array['DATE_MODIFIED'] = ????; <--- how must I set?

    return $the_array;
    }

    Regards
    Vincenzo

  5. #5
    SugarDev.net is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    1,401

    Default Re: Show datetime values with seconds

    There's a class DateTimeUtil (http://www.sugardev.net/api/510/html...hp-source.html), you can make your revisions there.

    Please note that this may cripple sugar for future upgrades.

    My advice: copy DateTimeUtil.php to DateTimeUtil.php.orig and copy it back before an upgrade. You can optionally review the upgrade file and see whether there's a new version of DateTimeUtil.php to see if you need to copy it back beforehand.
    Developers go here
    Businesses go there (Dutch)

    Modules:
    SugarDev.net Developer Tools | Config | Dutch Language Pack
    "Nothing gets fixed unless there is a bug"

  6. #6
    sorrentinov is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    12

    Default Re: Show datetime values with seconds

    Thx for your speed answer,

    But I don't understand how can I obtain date_modified with seconds only in a particular subpanel.

    The problem is that when called get_list_view_data all fields has been already formatted and
    date_modified (that on DB is 2008-10-09-09:56:34) come as 09/10/2008 09:56

    I think I'm not able to obtain "34" seconds using DateTimeUtil starting from $the_array['date_modified'] without seconds
    I want just show in subpanel 09/10/2008 09:56:34 also having default_time_format = "H:i"

    Is it possible?

    Thx in advance
    Vincenzo

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to change DB values for this DropDown
    By fai.hans in forum Help
    Replies: 2
    Last Post: 2008-04-03, 10:25 PM
  2. Related to field show objects instead of values
    By jpabellon in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2008-01-10, 09:39 AM
  3. Replies: 0
    Last Post: 2006-02-23, 06:46 PM
  4. 4.0.1 Installation Problem
    By clawton in forum Help
    Replies: 14
    Last Post: 2006-02-13, 04:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •