Prabha
Prabha

Reputation: 273

How to get utcoffset based on given date in coldfusion

In ColdFusion, using GetTimeZoneInfo() methods, we can get utcoffset time based on the server current date and time, but as per my requirement for the given date like 2020-06-23 21:03:37, the utcoffset should be given as "5", for now it is "4",

Please suggest in ColdFusion 9 version and also I want to know the client OS date offset, but found that cfm is server side, so not support this.

Upvotes: 1

Views: 181

Answers (1)

James A Mohler
James A Mohler

Reputation: 11120

Getting the time zone requires client side code, aka Javascript. If I had jQuery at my disposal, I would consider

<script>
$( document ).ready(function() {
    d = new Date();
    n = d.getTimezoneOffset();

    $("#offset").val(n);
});
<script>


<form>
   ...
   <input type="hidden" name="offset" id="offset>
   ...
</form>

Upvotes: 1

Related Questions