Jump to content

Problems with _DateAdd and _DateSplit


Recommended Posts

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
Link to comment
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]
Link to comment
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))
;
Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...