Date & Time Apex class


We can also create date and time from the current clock.
Date my  DateTime.now();
Date t= Date.today();
The date and time classes also have instance methods for converting from one format to another.
Eg:Time t2 = DateTime.now().time();

We can also manipulate the values by using a range of instance methods.
Ex: Date t3 = Date.time(0);
Date next  =  t3.addDays(30);

We will get smething like this as the output.

2013-05-15 00:00:00
2013-06-16 00:00:00


No comments:

Post a Comment