How To save date and time value in date and time field in sugarcrm using before save logic hook ?
How To save date and time value in date and time field in sugarcrm using before save logic hook ?
Hi Gupta,
If you want to populate current date time value in date time field then we can achieve this by adding formula in date time field from studio.
If you want to set date time field with any other value (other than current date time) then you have to write code in create.js file in respective module.
Hi All,
I am trying to fetch date create/ date modified from (any table) database using custom query query in sugarcrm entry point but accurate date not fetched using query.
Exm. date_create-03-03-2020 03:23:45 (CRM Module display date created)
but when i select to fetch this date using custom Query in sugarcrm date create mismatch
so problem is that how we can fetch same date and time as crm create shows.
Thanks
MG
Hi All,
I am trying to fetch date create/ date modified from (any table) database using custom query query in sugarcrm entry point but accurate date not fetched using query.
Exm. date_create-03-03-2020 03:23:45 (CRM Module display date created)
but when i select to fetch this date using custom Query in sugarcrm date create mismatch
so problem is that how we can fetch same date and time as crm create shows.
Thanks
MG
Hi Gupta,
If we are fetching date time value from database, will get the value with the difference of 5 hours 30 minutes. So, to get exact date time value as shown on sugar UI we have to change/modify the date format through code.
Example
date('d-m-Y H:i:s',strtotime('+5 hour +30 minutes',strtotime(date_value)));
in place of 'd-m-Y H:i:s' you can use your required date time format.
date_value - pass the date time field value (retrieved date time value from query)
Also please refer the below link to format the date time value using sugar default method.
Please let me know in case of any queries.
date field. datetime. A date and time field. enum. A dropdown field.