Date Conversion and subtracted question

Results 1 to 3 of 3

Thread: Date Conversion and subtracted question

  1. #1
    Join Date
    Dec 1969

    Default Date Conversion and subtracted question

    Hi all. I have to access a DB with a .vbs script specifically, a field that is used to identify the date and time. But it is a bit trickier than that...instead of using some kind of humanly readable time, they use the...the difference of Now() and 1/1/1970 minus 4 hours. Don&#039;t even ask why because I dont know. All I know is I can do nothing about this. With that said..I have the following code.<BR><BR><BR>Current = datediff("s",cdate("1/1/1970 00:00:00"),Now()) &#039;get date diff from 1/1/70 in seconds <BR>CurrentConv = (current/86400) + cdate("1/1/1970") &#039;change it to a real date so I can subtract 4 hrs<BR>CurrentCalc = DateAdd("s",-4,CurrentConv) &#039;subtract 4 hrs<BR><BR>The above code works fine...The problem is in order to subtract the 4 hours, I need to get it into the normal dateformat..which i do..then I subtract the 4 hours. I now need to get it back to seconds diff from 1/1/1970...How can I go about this? Forgive if i&#039;m overlookin somethin obvious, its beena long day <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Date Conversion and subtracted question

    Can&#039;t you just skip the conversion step and subtract 4*60*60 seconds instead?

  3. #3
    Join Date
    Dec 1969

    Default I don't get it...

    ...why don&#039;t you simply adjust the start date by those 4 hours????<BR><BR>datediff("s",cdate("12/31/1969 20:00:00"),Now())<BR><BR>????<BR><BR>Or, if I read you wrong,<BR><BR>datediff("s",cdate("1/1/1970 04:00:00"),Now())<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts