Sign in to follow this  
Followers 0
atzoref

Using Windows date/time pattern

5 posts in this topic

Hi all,

I have for example this Time pattern: " 2012-06-27 10-37-50 " (YYYY-MM-DD hh-mm-ss)

How can I convert it to an absoulte time, so I can add num of seconds up or dowwn for example

And then convert it back to the pattern (YYYY-MM-DD hh-mm-ss)

Is it possible?

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Change the format from YYY-MM-DD HH-MM-SS to YYYY/MM/DD HH:MM:SS and then use function _DateAdd.

$sDate = StringReplace("2012-06-27 10-37-50", "-", "/", 2)
$sDate = StringReplace($sDate, "-", ":", 2)
ConsoleWrite($sDate & @CRLF)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

I'm using :

Local $iDateCalc = _DateDiff('s', "1970/01/01 00:00:00", $sDate)
MsgBox(4096, "", "Number of seconds since EPOCH: " & $iDateCalc)

iDateCalcNew = iDateCalc + 7

How can I convert this value of iDateCalcNew (Seconds since 1970) back to Date and Time format?

Edited by atzoref

Share this post


Link to post
Share on other sites

Use this function written by trancexx.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Try this:

#include <Date.au3>

$sDateStart = "1970/01/01 00:00:00"
$iSeconds = 10
$sNewDate = _DateAdd("s", $iSeconds, $sDateStart )
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sNewDate = ' & $sNewDate & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0