How to get time zone from request

Possible duplicate:
Can you define the time zone from the query variables?

Hi guys,

I have a requirement when in me I need to convert a long value (which I get from the model using the System.currentmillis method) into a date form in accordance with the corresponding time zone.

I tried this (I know that its bad practice has Java code, but I have not seen any parameters):

<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 someone please help me get the date according to the time zone of the request? And is it possible to use jstl tags to get the request timezone?

Thanks in advance. Almas

+3
source share

No one has answered this question yet.

Source: https://habr.com/ru/post/1779554/


All Articles