Sign in to follow this  
Followers 0
GrahamT

Problems with _DateAdd and _DateSplit

4 posts in this topic

#1 ·  Posted (edited)

I want to do the following:

$NowTime = _NowCalc()
$NewTime = _DateAdd( 'n',90, $nowTime)

which works fine.

But, then I want to extract from the $NewTime string, the time in hh:mm format. I'm sure I can do it with _DateSplit. but I can't figure out how.

Any help appreciated.

Thanks,

Graham

Edited by GrahamT

Share this post


Link to post
Share on other sites



Dim $Date
Dim $Time
_DateTimeSplit($NewTime, $Date, $Time)
$TimeStr = StringFormat("%02i:%02i", $Time[1], $Time[2])


[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites

I want to do the following:

$NowTime = _NowCalc()
$NewTime = _DateAdd( 'n',90, $nowTime)

which works fine.

But, then I want to extract from the $NewTime string, the time in hh:mm format. I'm sure I can do it with _DateSplit. but I can't figure out how.

Any help appreciated.

Thanks,

Graham

Try this.

;
#include <Date.au3>
MsgBox(0, "", "Now: " & _NowCalc() & @CRLF & _
        "Now Plus 90 minutes: " & _DateTimeFormat(_DateAdd('n', 90, _NowCalc()), 3))
;

Share this post


Link to post
Share on other sites

Try this.

;
#include <Date.au3>
MsgBox(0, "", "Now: " & _NowCalc() & @CRLF & _
        "Now Plus 90 minutes: " & _DateTimeFormat(_DateAdd('n', 90, _NowCalc()), 3))
;
Brilliant - thanks very much!

Graham

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