Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Unix Time Stamp

Reply
Thread Tools

Unix Time Stamp

 
 
Shahid Juma
Guest
Posts: n/a
 
      09-28-2004
Hi,

I am trying to replicate the Unix Timestamp,specifically the function
mktime() in Vbscript, ASP. I have the following so far:

ThisTime = DateSerial(2004, 9, 27) + TimeSerial(0, 0, 0)
response.write DateDiff("s", "12/31/1969 00:00:00", ThisTime)

This returns the timestamp: 1096329600, and when you decode that it comes
to: 27 Sep 2004 20:00. I want to set the time too, ie. show for example: 27
Sep 2004 16:15

Any ideas?

Thanks,
Shahid
(remove the words "REMOVETHIS" when replying to email address)


 
Reply With Quote
 
 
 
 
Shahid Juma
Guest
Posts: n/a
 
      09-28-2004

"Andrew Urquhart" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> *Shahid Juma* wrote in microsoft.public.inetserver.asp.general:
> > I am trying to replicate the Unix Timestamp,specifically the function
> > mktime() in Vbscript, ASP. I have the following so far:
> >
> > ThisTime = DateSerial(2004, 9, 27) + TimeSerial(0, 0, 0)
> > response.write DateDiff("s", "12/31/1969 00:00:00", ThisTime)
> >
> > This returns the timestamp: 1096329600, and when you decode that it

comes
> > to: 27 Sep 2004 20:00. I want to set the time too, ie. show for example:

27
> > Sep 2004 16:15
> >
> > Any ideas?

>
> Why not just invoke a JScript function from within your VBScript since
> JScript dates follow the same Unix format (AFAIK)?
>
> <script language="JScript" runat="server">
> function GetUnixTime(strDate) {
> if (strDate) {
> return new Date(strDate).valueOf();
> }
> else {
> return 0;
> }
> }
> </script>
> <%=GetUnixTime("Tue, 28 Sep 2004 14:45:28 GMT")%>
>
> (not tested)
> --
> Andrew Urquhart
> - FAQ: http://www.aspfaq.com
> - Archive: http://andrewu.co.uk/r/?6 (Google Groups)
> - Contact me: http://andrewu.co.uk/contact/


Thanks, that did work, however, it returns back a value that is 13 in
length. In PHP,it returns it with length of 10. I just took the first 10 and
it did work. Is there any other way? Besides doing it this way?

Thanks,
Shahid


 
Reply With Quote
 
 
 
 
Shahid Juma
Guest
Posts: n/a
 
      10-04-2004
A follow up to this question...

How do I convert it back and print the date, basically decode it.

Shahid

"Andrew Urquhart" <(E-Mail Removed)> wrote in
message news:1hfttct3zxit3$(E-Mail Removed)...
> *Shahid Juma* wrote in microsoft.public.inetserver.asp.general:
> > Thanks, that did work, however, it returns back a value that is 13 in
> > length. In PHP,it returns it with length of 10. I just took the first 10

and
> > it did work.

>
> That's the difference between seconds and milliseconds
>
> > Is there any other way? Besides doing it this way?

>
> http://www.aspfaq.com/show.asp?id=2219
> --
> Andrew Urquhart
> - FAQ: http://www.aspfaq.com
> - Archive: http://andrewu.co.uk/r/?6 (Google Groups)
> - Contact me: http://andrewu.co.uk/contact/



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time stamp problem Zean Smith ASP .Net 0 02-07-2006 03:19 PM
Saving time stamp for replied to email? Keith Firefox 4 01-17-2006 07:03 PM
Modifying a file's time stamp ladygrinningsoul Perl 1 12-06-2004 02:36 AM
Can Windows file time stamp be changed to shooting time? Gustav Digital Photography 8 07-31-2004 10:11 PM
Date/Time stamp in SQL =?Utf-8?B?QmVydA==?= ASP .Net 2 01-30-2004 04:47 PM



Advertisments