Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Date class
vuthlarhi donald
Ranch Hand
Posts: 76
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I want to get of after 30 days...if 2day is the 1st of April..The program must return 31st of April..please help me
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.example.test; import java.util.Calendar; import java.text.SimpleDateFormat; /** * * @author Administrator */ public class DateUtils { public static String now(String dateFormat) { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); return sdf.format(cal.getTime()); } public static void main(String arg[]) { System.out.println(DateUtils.now("MM/dd/yy")); } }
Jesper de Jong
Java Cowboy
Posts: 16084
88
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Look in the API documentation of class Calendar. It contains methods to do date arithmetic.
Jesper's Blog
-
Pluralsight Author Page
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to get tomorrow's date?
Convert date format to timestamp
Date Format ,Please help!
Date function
Date format question
More...