System.debug('Date and Time in GMT is....: '+system.now()); System.debug('Local Date is....: '+system.now().year()+'-'+system.now().month()+'-'+system.now().day()); system.debug('Local Time is....: '+System.now().hour()+':'+system.now().minute()+':'+system.now().second()+':'+system.now().millisecond());
The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought you have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention. https://loanhome.hatenablog.comhttps://autodealerz.blogspot.com
Great to be here in your article or post, whatever, I figure I ought to likewise buckle down for my own site like I see some great and refreshed working in your site. news blog
Here is some psuedo-code:
DateTime dT = System.now();
Date myDate = date.newinstance(dT.year(), dT.month(), dT.day());
All Answers
Here is some psuedo-code:
DateTime dT = System.now();
Date myDate = date.newinstance(dT.year(), dT.month(), dT.day());
iam still getting the time value but it set to 00;0:0
can we make this time value excluded?
Please help me any help is greatly appreciated.
Thanks
Bhanu
Hi Bhanu,
try this. I was getting same issue but this resolved my problem...
string datetimestr = LastRunDate.format('MMMMM dd, yyyy');
this gives you date in this format:------- May 03, 2012
If you need more formatting on dates and times please follow this link
http://paulforce.wordpress.com/2009/08/27/formatting-time-in-apex/
public String sdate {get;set;}
DateTime dT = System.now();
myDate = date.newinstance(dT.year(), dT.month(), dT.day());
sdate = String.valueOfmyDate);
Now it's displaying Only Date
Convert Datetime to Date
Public Date mydate{get;set;}
public String sdate {get;set;}
DateTime dT = System.now();
myDate = date.newinstance(dT.year(), dT.month(), dT.day());
sdate = String.valueOfmyDate);
Now it's displaying Only Date
DateTime dt = System.now()
Date d = dt.date();
System.debug(d);
System.debug('Local Date is....: '+system.now().year()+'-'+system.now().month()+'-'+system.now().day());
system.debug('Local Time is....: '+System.now().hour()+':'+system.now().minute()+':'+system.now().second()+':'+system.now().millisecond());
Date todaysDate = system.today();
OR use DateTime class
Date todaysDate = datetime.date();
DateTime tDateTime = datetime.now();
tDateTime = tDateTime.addHours(9);
tDateTime = tDateTime.addMinutes(30);
DateTime dT = system.now()
Date myDate = date.newinstance(dT.year(), dT.month(), dT.day());
String datevalue = String.valueOf(myDate);
Thanks,
shashikant
news blogHi,
Thanks
DateTime myDateTime = system.now();
Date myDate = myDateTime.date(); (or) myDateTime.dateGMT();