2

Possible Duplicate:
Can You Determine Timezone from Request Variables?

I have a requirement where in I have to convert long value (that I get from model by System.currentmillis method) into date form according the to respective timezone.

I tried this (I know its bad practice to have java code but i didnt see any options):

<c:set var="timezone">   
    <% java.util.Calendar.getInstance(request.getLocale()).getTimeZone().getID(); %>  
</c:set>  
<jsp:useBean id="startDateValue" class="java.util.Date" />    
<jsp:setProperty name="startDateValue" property="time" value="${taskStatsMap['value']['taskStartTime']}" />   
<td class="tdcenter">
    <fmt:formatDate type="both" dateStyle="short" timeStyle="long" value="${startDateValue}" timeZone="${timezone}" />
</td>  

Can somebody please help me to get date as per request timezone? And is it possible using jstl tags to get request timezone?

peterh
  • 11,875
  • 18
  • 85
  • 108
Almas
  • 139
  • 1
  • 2
  • 4
  • @org.life.java: the link you mentioned is for `asp.net` & `.net 3.5`. The question here is about `how to do it in java and jsp using jstl`. though he can use the javascript solution given by devstuff http://stackoverflow.com/questions/338482/can-you-determine-timezone-from-request-variables/388219#388219 – Favonius Dec 10 '10 at 07:35
  • @Favonius ah yes, but It is the same answer will do here. its not technology specific here, The general sol. given there – jmj Dec 10 '10 at 07:39
  • getTimezoneOffset on Date is deprecated.. Also would be helpful if you can tell me how offset will help me here? – Almas Dec 10 '10 at 09:23

0 Answers0