yannis assael | the blog

  • Home
  • About
  • Categories
    • Android
    • Computing
    • iOS
    • Machine Learning
    • MacOSX
  • GitHub
  • Mobile Apps
  • yannisassael.com


Convert Javascript Date from UTC to Local Timezone

Written by iassael on 03/05/2013. Posted in android, computing, iOS

var strdate = ‘2013/05/03 03:13:00’;
var d = new Date(strdate);
var d = new Date(d.getTime() – d.getTimezoneOffset() * 60 * 1000);

used it with Titanium Appcelerator

Tags: appcelerator, Date, getTimezoneOffset, javascript, local, timezone, utc

Trackback from your site.

Comments (1)

  • Avatar

    REST API Basics in Java

    21/05/2013 at 9:20 am | #

    Awesome post. Appreciate your hardwork

    I have an issue with date in my project. From Back end java code, i am sending date to front end,

    In front end i am comparing current client browser time to back end date,

    For this i am having lot of issues.

    so i tried to do both back end and front end dates as UTC date

    My Back end date is ‘Tue May 21 2013 07:01:41’

    and Front end date in js is ‘Tue, 21 May 2013 06:57:39 GMT’ using now.toUTCString() function.

    How can i remove GMT in front end using java script?

    Thanks
    Grep Command Examples in Linux/Unix

Leave a comment