DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Re: Converting date from/to milliseconds - Please help!

  1. #1
    Nizar Guest

    Re: Converting date from/to milliseconds - Please help!


    Hello all,
    I would appreciate it if someone could tell me how to convert a date into
    milliseconds and back from milliseconds into date format in vbscript.
    thanks in advance,
    nizar
    "Nizar" <noorani_786@yahoo.com> wrote:
    >
    >No, that doesn't work. The datePart function just gives you a specific

    part
    >of a date, ex. month, day, year, etc. It doesnt convert a date into milliseconds.
    >
    >"Q*bert" <luke_davis_76@hotmail.com> wrote:
    >>
    >>Look into the datepart function.
    >>
    >>TimeInSeconds=datePart("s",DateToConvert,StartDate)
    >>I think ms is the millisecond relation.
    >>
    >>DateToConvert: is the date that you want to convert
    >> StartDate: is the stat date from which you want to begin your count

    >in
    >>milliseconds
    >>
    >>"s" is the qualifer for which you want to convert to.
    >>
    >>
    >>Hope this helps.
    >>Q*bert
    >>"Nizar" <noorani_786@yahoo.com> wrote:
    >>>
    >>>Hello all,
    >>>I was wondering how to convert a date from milliseconds to date format

    >(1/1/2003)
    >>>and back from date format into milliseconds in vbscript (asp). I know

    >how
    >>>its done in javascript but I have to use vbscript.
    >>>thanks in advance,
    >>>nizar

    >>

    >



  2. #2
    Q*bert Guest

    Re: Converting date from/to milliseconds - Please help!


    Ok, what about DateDiff.

    I assume you have a starting date that you want to begin your count in Milliseconds
    from. In the Unix world I think it's something like Midnight of January
    1st 1960.

    So if you want to know the milliseconds that occured from then, you could
    do the following DateDiff("ms",Now,Cdate("01/01/1960 00:00:00")
    Again, I'm not sure if ms is an option of datediff, you may have to fist
    start at seconds and then do the conversion to ms.

    Now to add back in you will have to do a DateAdd(Param,Param,Param)
    So I'm guessing that the functions your after are DateAdd and DateDiff.


    "Nizar " <noorani_786@yahoo.com> wrote:
    >
    >Hello all,
    >I would appreciate it if someone could tell me how to convert a date into
    >milliseconds and back from milliseconds into date format in vbscript.
    >thanks in advance,
    >nizar
    >"Nizar" <noorani_786@yahoo.com> wrote:
    >>
    >>No, that doesn't work. The datePart function just gives you a specific

    >part
    >>of a date, ex. month, day, year, etc. It doesnt convert a date into milliseconds.
    >>
    >>"Q*bert" <luke_davis_76@hotmail.com> wrote:
    >>>
    >>>Look into the datepart function.
    >>>
    >>>TimeInSeconds=datePart("s",DateToConvert,StartDate)
    >>>I think ms is the millisecond relation.
    >>>
    >>>DateToConvert: is the date that you want to convert
    >>> StartDate: is the stat date from which you want to begin your count

    >>in
    >>>milliseconds
    >>>
    >>>"s" is the qualifer for which you want to convert to.
    >>>
    >>>
    >>>Hope this helps.
    >>>Q*bert
    >>>"Nizar" <noorani_786@yahoo.com> wrote:
    >>>>
    >>>>Hello all,
    >>>>I was wondering how to convert a date from milliseconds to date format

    >>(1/1/2003)
    >>>>and back from date format into milliseconds in vbscript (asp). I know

    >>how
    >>>>its done in javascript but I have to use vbscript.
    >>>>thanks in advance,
    >>>>nizar
    >>>

    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center