The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

i think i got it

Posted by alex on November 04, 2001 at 11:09 PM

dear deviprasad mundluru

thanx fer the advise. the jscript works fine!!

for JAVA however, my fren proposed that i use the SimpleDateFormat. it's kinda sloppy. ehe. but it gets the job done.

SimpleDateFormat dateFmt =
new SimpleDateFormat("yyyy-MM-dd");

TimeZone mst = TimeZone.getTimeZone("CTT");
dateFmt.setTimeZone(mst);
String dateString = dateFmt.format(new java.util.Date());

but to get the exact field of day, month and year.. depends
on how we define the format.

year = Integer.parseInt(dateString.substring(2,4))+100;
month = Integer.parseInt(dateString.substring(5,7))-1;
day = Integer.parseInt(dateString.substring(8,10));





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us