date time subtraction

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
perinho
Posts: 1
Joined: 17 May 2018 04:50

date time subtraction

#1 Post by perinho » 17 May 2018 05:43

I want to create a batch file that will read a string of numbers (e.g. 20180517120101) from inside a text file (e.g. C:\Users\Public\Documents\Admin\exetime.txt) and recognize these as date and time (yyyyMMddHHmmss)
the batch file will then subtract the current time from this, and write the answer into another text file (e.g. C:\Users\Public\Documents\Admin\elapsed.txt)
The answer would preferably be in days (e.g. 0.2 or 64)

I have a low level knowledge of coding and wondering is this even possible?
If this is possible, a solution would be fantastic.

Many thanks.
p.

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: date time subtraction

#2 Post by Squashman » 17 May 2018 07:24

I would use Dave's JTimeStamp script to calculate the date and time offset.

miskox
Posts: 553
Joined: 28 Jun 2010 03:46

Re: date time subtraction

#3 Post by miskox » 18 May 2018 04:47

Maybe this is useful:

viewtopic.php?p=40009#p40009

Saso

Post Reply