Forum Discussion

nebsta's avatar
nebsta
Contributor
9 years ago

UTC DateTime in JScript

Hi,

 

I am testing a WPF application where all DateTimes are in UTC - I need to be able to set a parameter to the current UTC date time but JScript doesnt seem to be able to support this e.g. if I use aqDateTime.Today() or aqDateTime.Now() it will set the date/time elements according to my current timezone. Does anyone know of a way around this?

  • function datett(){
    var d = new Date();
    var n = d.getUTCDate();
    var h = d.getUTCHours();
    var m = d.getUTCMinutes();
    var s = d.getSeconds();
    Log.Message('Today is '+n+'th .and now time is '+h+' Hours..and '+m+'  minutes and '+s+'  second');
    }

    dose this helps?

  • NisHera's avatar
    NisHera
    Valued Contributor
    function datett(){
    var d = new Date();
    var n = d.getUTCDate();
    var h = d.getUTCHours();
    var m = d.getUTCMinutes();
    var s = d.getSeconds();
    Log.Message('Today is '+n+'th .and now time is '+h+' Hours..and '+m+'  minutes and '+s+'  second');
    }

    dose this helps?

    • nebsta's avatar
      nebsta
      Contributor

       

      Perfect! Thanks NisHera :smileyhappy: