Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Different between dates/time
I got two dates formatted like this
What I need to be able to do is figure out the time difference between those two, ie - 5 mins or 1 hour, 1 day etc.
Any ideas on where to start?
8/22/2022 - Mon
//For example you can try something like this:
result:=EncodeDateTime(y, m, d, h, min, s, ms);
Looks good, just testing now
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Just 1 question now...
Based on the above,
s1 = old time in GMT
s2 = time now in GMT
how can I make it so I can get
a1 = Current time local zone - TimeDifference of (s2 - s1) (as above) so would be just taking off the seconds from your above calculation?
I think it would be like, do your above and get
OldLocalTime := DecSec(Date(now), secDif);
So, Decrease the seconds of the Datenow by the secDif from above? That make sense....
I have upped the points...
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
Not sure if I understand you correctly...
so let's say we have
you know the values of OldGMT an NowGMT (and of course NowLocal) and you want to find out OldLocal?
)); //for going backwards in time, you can use IncSecond with a negative value
But keep in mind that SecondsBetween only returns full seconds, if you want to work with milliseconds difference, either use MilliSecondsBetween,
or (for large time spans) SecondSpan. Secondspan will return seconds with second fractions (as a Double).
Ah thats sound like it :-)
:D Thanks a lot!
You're welcome - for UTC to local, local to UTC time conversions (and other useful stuff), see:
and the Jedi project's JclDateTime.pas
to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Hmmm when I do
I just get the date (like 8/09/2006) with no time....
I was doing DateToStr NOT DateTimeToStr
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent