منبع اصلی نوشتار زیر در این لینک قرار دارد

Set TimeZone in JAVA

\"\"Set time zone in a web application is very important , The importance for it is more peresent a service
in several point in world (Internet logic) with different time , for example a customer use from you application in london
and another customer use it from tehran , … .

Example Code :

First import =>  java.util.Date , java.util.TimeZone , java.text.SimpleDateFormat

Define a function for :
Date cd = new Date();
SimpleDateFormat sdf = new SimpleDateFormat();
TimeZone tz = TimeZone.getTimeZone(“GMT”); // Set` TimeZone` on local time ‘GMT’
sdf.setTimeZone(tz);
sdf.format(cd);
Download Sample Class



برچسب ها :

به سیاره لینوکس امتیاز دهید

به اين صفحه امتياز دهيد