Convert Milliseconds to dateformat in JavaScript

does somebody know, how to convert a Number of Milliseconds (for example 1121622365429) to a date format yyyy mm dd hh mm ss - in JAVASCRIPT (not Java) ... (date-components in seperate Strings) ???
thx for answering

Does JAVASCRIPT actually have documentation? Not that I care, this is a forum about the use of XML in Java, where the OP's question is completely off-topic.

Similar Messages

  • How to convert milliseconds to date format in sql query

    Hi All,
    The following code is in java.     
    String yourmilliseconds = "1316673707162";**
    Date resultdate = new Date(Long.parseLong(yourmilliseconds));
    could you plese tell me how to convert milliseconds into date format in query and comparing with another date like(sysdate-3)

    Hello,
    http://stackoverflow.com/questions/3820179/convert-epoch-to-date-in-sqlplus-oracle
    Regards

  • How to convert milliseconds to HH:MM:SS

    hi
    how to convert milliseconds to HH:MM:SS and also is that possible to covert milliseconds to hh:mm:ss and date , plz any idea
    thanks in advance
    reg
    vino

    public int miliseconds;
    public String time;
    public void change(){
    int seconds= miliseconds* 100;
    if(seconds> 0){
    String sec;
    sec= "" + (seconds%60);
    if(seconds % 60 <10){
    sec= "0" + (seconds%60);
    String min;
    if(seconds > 60){
    min= ""+ (seconds/60%60);
    if((seconds/60%60)<10){
    min= "0" + (seconds/60%60);
    else{
    min= "00";
    String hours;
    if(seconds/60 > 60){
    hours= ""+ (seconds/60/60);
    if((seconds/60/60) < 10){
    hours= "0" +
    (seconds/60/60);
    else{
    hours= "00";
    time= "" + hours + ":" + min + ":" + sec;
    or you can do whatever the prev reply said, im too
    lazy to read that...eeew! You should read the links provided super.

  • Need help on converting milliseconds to string.

    Hi,
    I am really confused by GMT. I need to convert milliseconds to string. A millisecond represents the date of 2/14/02 22:37:27 GMT. I formatted the string so that output is in the right format. But I kept getting a time string of "02/14/02 16:37:27". How do I get a string of "02/14/02 22:37:27" instead? My local time zone is GMT-6.
    Thank you very much.

    Is it a Calendar object you are using? If so it look slike there is a method called setTimeZone(). Its clear by your output that you are getting a local time for your zone so you just need to change the zone for that particular Calendar object (I think I never tried it)

  • Need help for converting c# encryption code to javascript

    I have this below code in c# i need to convert it into nodejs i would really appriciate some help in this.
    Rfc2898DeriveBytes passwordDb2 = new Rfc2898DeriveBytes(passphrase, Encoding.ASCII.GetBytes(DeriveSalt(grains)));
    byte[] nonce = passwordDb2.GetBytes(NonceSize);
    AesManaged symmetricKey = new AesManaged { Mode = CipherMode.ECB, Padding = PaddingMode.None };
    _encryptor = symmetricKey.CreateEncryptor(_nonces[0], null);
    public byte[] Encrypt(byte[] plainText, int blockIndex)
    byte[] nonceEncrypted = new byte[NonceSize];
    byte[] outputData = new byte[_chunkSize];
    _encryptor.TransformBlock(_nonces[blockIndex], 0, NonceSize, nonceEncrypted, 0);
    for (int i = 0; i < _chunkSize; i++)
    outputData[i] = (byte)(plainText[i] ^ nonceEncrypted[i % NonceSize]);
    return outputData;
    public byte[] Decrypt(byte[] encryptedText, int blockIndex)
    byte[] nonceEncrypted = new byte[NonceSize];
    byte[] outputData = new byte[_chunkSize];
    _encryptor.TransformBlock(_nonces[blockIndex], 0, NonceSize, nonceEncrypted, 0);
    int index = 0;
    for (int i = 0; i < _chunkSize; i++, index++)
    if (index == NonceSize)
    index = 0;
    outputData[i] = (byte)(encryptedText[i] ^ nonceEncrypted[index]);
    return outputData;
    Currently i have the below code from what i understood (I am quite new to nodejs)
    var crypto = require("crypto");
    var nonce = crypto.pbkdf2Sync(passphrase, "grains", 1000, NonceSize);
    _encryptor = crypto.createCipheriv('aes-128-ecb', binkey, "");
    _decryptor = crypto.createDecipheriv('aes-128-ecb', binkey, "");
    Encrypt: function (plainText, blockIndex) {
    var nonceEncrypted = [NonceSize];
    var outputData = [_chunkSize];
    var crypted = Buffer.concat([_encryptor.update(plainText), _encryptor.final()]);
    for (var i = 0; i < _chunkSize; i++) {
    outputData[i] =(plainText[i] ^ nonceEncrypted[i % NonceSize]);
    var x = new Buffer(outputData);
    return x;
    Decrypt: function (encryptedText, blockIndex) {
    var nonceEncrypted = [NonceSize];
    var outputData = [_chunkSize];
    var decrypt = Buffer.concat([_decryptor.update(encryptedText), _decryptor.final()]);
    var index = 0;
    for (var i = 0; i < _chunkSize; i++, index++) {
    if (index == NonceSize)
    index = 0;
    outputData[i] = (encryptedText[i] ^ nonceEncrypted[index]);
    var x = new Buffer(outputData);
    return x;

    Maybe, you should post to the Javascript secition of the ASP.NET forum.
    http://forums.asp.net/

  • Convert Milliseconds into specified format

    HI,
    How to convert System.currentMillis() into yyyy-mm-dd HH:MM:SS:SSS format?
    PLease give me a solution
    Thanks

    Use
    long currTime = System.currentTimeMillis();
    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(currTime);
    System.err.println(cal);
    LOL, have you run this codez? For me, it outputs:
    java.util.GregorianCalendar[time=1176827393171,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2007,MONTH=3,WEEK_OF_YEAR=16,WEEK_OF_MONTH=3,DAY_OF_MONTH=17,DAY_OF_YEAR=107,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=9,HOUR_OF_DAY=9,MINUTE=29,SECOND=53,MILLISECOND=171,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]

  • How to convert Milliseconds into Date format

    Hi all,
    I am getting the output of a variable in milliseconds format, how can I convert it into date format
    For ex: I am getting input variable as 1366664691000 and I need to convert it to April 22, 2013 5:04:51 PM EDT ( or of SOA format). is there any function for this in XSL or XPath?
    Thanks,

    It is working fine if i test it in provided site...
    But it is returning "-1366664691001", If i am running it in EM. This is the code in my xsl
    <?xml version="1.0" encoding="UTF-8" ?>
    <?oracle-xsl-mapper
    <!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->
    <mapSources>
    <source type="WSDL">
    <schema location="../JavaProcess.wsdl"/>
    <rootElement name="process" namespace="http://xmlns.oracle.com/SampleApplication/JavaEmbeddingActivity/JavaProcess"/>
    </source>
    </mapSources>
    <mapTargets>
    <target type="WSDL">
    <schema location="../JavaProcess.wsdl"/>
    <rootElement name="processResponse" namespace="http://xmlns.oracle.com/SampleApplication/JavaEmbeddingActivity/JavaProcess"/>
    </target>
    </mapTargets>
    <!-- GENERATED BY ORACLE XSL MAPPER 11.1.1.4.0(build 110106.1932.5682) AT [TUE MAY 07 10:21:02 EDT 2013]. -->
    ?>
    <xsl:stylesheet version="1.0"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction"
    xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
    xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
    xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:med="http://schemas.oracle.com/mediator/xpath"
    xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
    xmlns:bpm="http://xmlns.oracle.com/bpmn20/extensions"
    xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk"
    xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:bpmn="http://schemas.oracle.com/bpm/xpath"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
    xmlns:client="client"
    exclude-result-prefixes="xsi xsl bpws xp20 mhdr bpel oraext dvm hwf med ids bpm xdk xref bpmn ora socket ldap">
    <xsl:template match="/">
    <xsl:variable name="lastMTime" select="1366664691000"/>
    <xsl:copy-of select="$lastMTime"/>
    <client:processResponse>
    <client:result>
    <xsl:value-of select='xsd:dateTime("1970-01-01T00:00:00") + $lastMTime * xsd:dayTimeDuration("PT0.001S")'/>
    </client:result>
    </client:processResponse>
    </xsl:template>
    </xsl:stylesheet>

  • Convert milliseconds to formatted data in JAVA

    hi all,
    i want to convert my time in milliseconds to HH:MM:SS:sss format ,
    i use ;
    Date date = new Date(timeInMills);
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss:SSS");
    String s = sdf.format(date.getTime());
    but it gives me: 02:00:00:150 instead of 00:00:00:150
    i think it is about the TimeZone. What can i do to prevent this.?

    If you insist on doing it this way, then read the API docs for SimpleDateFormat, and the class(es) from which it inherits closely, as one of them contains a method for setting the timezone, which don't you think it would be a good idea to set the timezone to GMT/UTC rather than worrying about any local timezone effects?

  • Convert millisecond time value to date

    If i have a millisecond time value, say long timeValue, how do I convert this value to a time and a date?

    Or directly set a new date using the constructor
    Date(long date)
    Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
    N.B. - Note that the Date class method to set a date from a long is:
    setTime(long time)
    Sets this Date object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.
    setTimeInMillis() is a Calendar method , only.

  • Converting Simple Indesign AppleScript to Javascript

    Hi,
    I have been using as imple Indesign AppleScript but need to convert it to javascript and have no prior experience.  I've been reading the Adobe pdf about scripting and it is great as it shows the differences between the 3 (as, js, vb) but I'm still having trouble figuring out how this would conver.  Would anyone be able to show me the converted result?
    AppleScript:
    tell application "Adobe InDesign CS5.5"
         tell every document
              set visible of layer "Interactive - Web" to true
              set visible of layer "Interactive - Print" to false
         end tell
    end tell
    Javascript:
    var myDocuments = app.documents.everyItem(); // something like this?
    It hides/shows the visibility of 2 specific layers for all opened documents.  I pretty much need to hide/show 2 specific layers ina  book and this should/can accomplish that.
    Thanks for any help!

    This should work:
    var documentsArray = app.documents.everyItem().getElements();
    for (var i = 0; i < documentsArray.length; i++) {
              var document = documentsArray[i];
              var layers = document.layers;
              layers.itemByName("Interactive - Web").visible = true;
              layers.itemByName("Interactive - Print").visible = false;
    Also, it might be possible to do this without using "getElements" which "resolves the object specifier", eliminating the need for the "for" loop. Something like this:
    app.documents.everyItem().layers.itemByName("Interactive - Web").visible = true;
    app.documents.everyItem().layers.itemByName("Interactive - Print").visible = false;

  • Converting milliseconds into formatted HHh MM' SS''

    Is there an example of a NumberFormat class that converts a certain amount of milliseconds, say 2374894 into hours, minutes, and seconds like this: HHh MM' SS''?

    That is the approach I was taking before, but the specification requires that I use a NumberFormat class. No strings allowed...
    I have the logic created (this is not in Java):
    public function formatDuration():String
       var convResult:Number = 0;
       var hours:Number = 0;
       var minutes:Number = 0;
       var seconds:Number = 0;
       var minutesString:String;
       var secondsString:String;
       hours = parseFloat(integerFormat.format(durationMs / 3600000));
       convResult = (summaryData.durationMs / 3600000) - hours;
       minutes = parseFloat(integerFormat.format(convResult * 60));
       convResult = (convResult * 60) - minutes;
       seconds = parseFloat(integerFormat1.format(convResult * 60));
       minutesString = minutes.toString();
       if(seconds<10)
          secondsString = "0" + seconds.toString();
       else
          secondsString = seconds.toString();
       if(durationMs >= 3600000)
          return hours + "h" + minutesString + "'";
       else
          return minutesString + "'" + secondsString + "''";
    }

  • Is there any way to convert recorded actions into JSX Javascript file?

    For photoshop, there's http://ps-scripts.sourceforge.net/xtools.html (scroll down to "ActionFileToJavascript") which can convert recorded photoshop actions into jsx. Is there any such resource for Illustrator?

    AppleScript is able to script many things in the GUI.
    The problem is it becomes version specific when they move stuff about.
    CS6 can evoke some menus but is limited to those with keyboard shortcuts.
    CS6 also got action calls added... ( to JS )
    No nothing like action manager code exists in AI. ( a big shame )
    PS has a plug-in to record your steps...
    Giving you access to a whole range of app features beyond the regular DOM.
    Only today X has posted that that he's hanging up his boots here...

  • I need help converting an excel formula to javascript for a fillable form.

    Here is the scenario,
    If a person travels for 1 or 2 days we pay out a mealsrate of 75% per day. If 3 or more days we pay # days less 2 days * 25%. I hope that makes sense.
    V7 = Days, F14 = Mealsrate
    Formula in Excel
    =IF($V$7 = 1,$F$14*0.75,($V$7*$F$14)-(($F$14*0.25)*2))  and it works.
    I am VERY NEW to javascript (like yesterday) so don't laugh. I really have no idea what I am doing, but I was trying. Here is what i got. (by the way, It doesn't work)
    if(this.getField( ("Days").value=="1")){
    var f =this.getField("Mealsrate");
    event.value= f.value * .75;
    }else event.value = (Days * f.value)- (f.value *.25)*2;
    I appreciate all the help i can get.
    Tracie
    I'll be back on Monday, I hope I can find my post.

    OK, that Excel formula can be reduced a bit. The following custom Calculate scipt will do what the formula does:
    // Custom Calculate script
    (function () {
        // Get the inputs
        var days = getField("Days").value;
        var rate = getField("Mealsrate").value;
        // Set this field value
        if (days == 1) {
            event.value = 0.75 * rate;
        } else {
            event.value = (days - 0.5) * rate;
    It would make sense to add additional code to deal with negative numbers in either of the input fields.
    Edit: corrected a typo

  • Converting Date Into Milliseconds?

    I want to convert the following date and time into milliseconds: 4/21/2003 21.50. I know how to convert milliseconds into a date, but not the other way around. Could someone, please, help?

    String etd = "4/21/2003 10:45";
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
    df.setLenient(true);
    try {
    df.parse(etd);
    catch(Exception e) {
    e.printStackTrace();
    I'm trying to use DateFormat to convert a date into ms. However, I'm getting a parsing error. Any suggestions?

  • Converting Actionscript to Javascript

    When I think of the Cappucino framework. It converts Objective-J to pure Javascript in the browser no plugin required because the compiler itself is in Javascript.
    I am thinking, why dosen't Adobe do the same with Actionscript?
    Is this something feasable?

    I've spoken to a few people who think that an "Export to HTML(5)" option in Flash Pro would be awesome.  I have no idea how something like that would work, or if it is even possible.
    The Flex Framework relies heavily on Flash Player APIs.  I suspect there are not standard 'JavaScript' parallels for many if those APIs.

Maybe you are looking for

  • Help! My Mac Pro will not boot up

    I knew I shouldn't try to use the Boot Camp on my MP, but I thought it would work. I have three HD in my MP and followed the instructions for the installtion of WIN XP on Mac drive 3, but when I was faced with the formatting choices in the Win setup

  • Select List in Manual Tabular Form based on a previous column

    I have a manual tabular form that have several columns One column (vendor) is a select list that should be based on a previous column (Vendor Type - Internal/External). So if the user selects Internal for Vendor Type, the Vendor column's select list

  • Multiple user id per user

    HI guys we are implementing concurrent employement solution of SAP. Under that solution in certain circumstance user will be having multiple sap id. My question is ... Is CC 5.2 capable of reporting SOD conflicts taking into a/c all the sap id of use

  • Colours wrong when RAW file with Adobe RGB profile printed from iPhoto '08

    I've taken some photos on my Nikon D300 with the colourspace set to Adobe RGB. These import and display fine in iPhoto '08 but when printed it looks like the printer (Epson R2400 with the Epson 6.12 driver) is using the sRGB colourspace. The only opt

  • Will Apple ever become entrenched in the Business Workplace?

    The post Will Apple ever become entrenched in the Business Workplace? appeared first on PostmanMojo.com, Inc.. Read More This topic first appeared in the Spiceworks Community