Unix Time Stamp

S

Shahid Juma

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)
 
S

Shahid Juma

Andrew Urquhart said:
*Shahid Juma* wrote in microsoft.public.inetserver.asp.general:

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
 
S

Shahid Juma

A follow up to this question...

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

Shahid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top