Skip to main content
Tweeted twitter.com/StackSalesforce/status/1442730836642652161
added 10 characters in body
Source Link
Samuel De Rycke
  • 9.6k
  • 8
  • 46
  • 73

I want to Convert DateTime into Date

I have been trying this out ..below is the code snippet

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate =   date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
     }
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

I want to Convert DateTime into Date

I have been trying this out ..below is the code snippet

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate =   date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

I want to Convert DateTime into Date

I have been trying this out ..below is the code snippet

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate = date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
     }
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

I want to Convert DateTime to DateDateTime into Date

I have been trying this out ..below is the code snippet

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate =   date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDatesf.lastModifiedDate is shown as 2014-04-11 00:00:002014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

I want to Convert DateTime to Date

I have been trying this out ..below is the code snippet

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate =   date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

I want to Convert DateTime into Date

I have been trying this out ..below is the code snippet

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate =   date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

Code formatted
Source Link
Sergej Utko
  • 22.1k
  • 11
  • 60
  • 88

I want to Convert DateTime to Date

I have been trying this out ..below is the code snippet public void searchSFDC() { DateTime lastModDate ; for(sObject resultSet : searchResults[0]) { // searching only solutions SfResults sf = new SfResults(); lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate')); sf.lastModifiedDate = date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day()); } public class SfResults { public Date lastModifiedDate {get;set;} }

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate =   date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

I want to Convert DateTime to Date

I have been trying this out ..below is the code snippet public void searchSFDC() { DateTime lastModDate ; for(sObject resultSet : searchResults[0]) { // searching only solutions SfResults sf = new SfResults(); lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate')); sf.lastModifiedDate = date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day()); } public class SfResults { public Date lastModifiedDate {get;set;} }

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

I want to Convert DateTime to Date

I have been trying this out ..below is the code snippet

public void searchSFDC() {
    DateTime lastModDate ;
    for(sObject resultSet : searchResults[0]) { // searching only solutions
        SfResults sf = new SfResults();
        lastModDate=Datetime.valueOf(resultSet.get('LastModifiedDate'));
        sf.lastModifiedDate =   date.newinstance(lastModDate.year(),lastModDate.month(),lastModDate.day());
}
public class SfResults {
        public Date lastModifiedDate {get;set;}     
}

But sf.lastModifiedDate is shown as 2014-04-11 00:00:00 .I do not want the 00:00:00 timestamp .How can we achieve this?

Source Link
user7533
  • 415
  • 1
  • 6
  • 14
Loading