You need to sign in to do that
Don't have an account?
Smurfet15
Date format issue, removing the time 00:00:00
Hi guro,
I have a requirement display: Contract Date - 25/01/2015 to 24/01/2016
my code : contact_date = 'Contract Date' + ' - ' + string.valueOfGmt(s_date) + ' to ' + string.valueOfGmt(e_date);
Resulted to : Contract Date - 25/01/2015 00:00:00 to 24/01/2016 00:00:00
Tried this : contact_date = 'Contract Date' + ' - ' + s_date.format('dd/MM/yyyy') + ' to ' + s_date.format('dd/MM/yyyy')
but resulted to different date.
first code is fine but need to remove the time 00:00:00.
Thank,
Smurfet
I have a requirement display: Contract Date - 25/01/2015 to 24/01/2016
my code : contact_date = 'Contract Date' + ' - ' + string.valueOfGmt(s_date) + ' to ' + string.valueOfGmt(e_date);
Resulted to : Contract Date - 25/01/2015 00:00:00 to 24/01/2016 00:00:00
Tried this : contact_date = 'Contract Date' + ' - ' + s_date.format('dd/MM/yyyy') + ' to ' + s_date.format('dd/MM/yyyy')
but resulted to different date.
first code is fine but need to remove the time 00:00:00.
Thank,
Smurfet
This resulted to different date.
Hi Kevin,
This resulted to : 25/01/2015 00:00:00
Thanks for your help but still have the same issue.
Please shoot some answer of you know.
Thanks again Smurfet.
The above example code will exactly return what you want i.e "Contract Date - 25/01/2015 to 24/01/2016".
Could you share some additional info/code to debug?
Please take a look below:
Code:
datetime s_date = olitemUp.Maintenance_start_date__c;
datetime e_date = olitemUp.Maintenance_end_date__c;
contact_date1 = ' - ' + string.valueOfGmt(s_date) + ' to ' + string.valueOfGmt(e_date);
contact_date = 'Contract Date' + ' - ' + (s_date.day() +'/'+s_date.month()+'/'+s_date.year()) + ' - '+ (e_date.day()+'/'+e_date.month()+'/'+e_date.year());
system.debug('#contact_date1 : ' + contact_date1);
system.debug('#contact_date : ' + contact_date);
Debug----
12:41:07.907 (1907608200)|USER_DEBUG|[44]|DEBUG|#contact_date1 : - 2015-10-25 00:00:00 to 2015-10-30 00:00:00
12:41:07.907 (1907659194)|USER_DEBUG|[45]|DEBUG|#contact_date : Contract Date - 24/10/2015 - 29/10/2015
thanks,
Mary