Jump to content
Sign in to follow this  
mspoula

Getting the Year as two digits

Recommended Posts

mspoula

I cannot get my script to format the year as MM/DD/YY with autoit. Everything wants to give the full YYYY. THe program I am putting a date into requires the last two digits of the year.

Thanks,

Share this post


Link to post
Share on other sites
Manjish

use ths

msgbox(4096,"",StringRight(@YEAR,2))

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites
mspoula

found the answer.

$date = "20/01/2009"

MsgBox (0, $date & "(dd/mm/yyyy)", _EditDate ($date) & " (yy-mm-dd)")

Func _EditDate ($datestr)

$sD = StringSplit ($datestr, "/")

$day = StringRight ($sD[1], 2)

$month = StringRight ($sD[2], 2)

$year = StringRight ($sD[3], 2)

Return $year & "-" & $month & "-" & $day

EndFunc

Share this post


Link to post
Share on other sites
Proph

use ths

msgbox(4096,"",StringRight(@YEAR,2))
Manjish's example is much easier then your alternative. :)

$Date = @MONTH & "/" & @MDAY & "/" @ StringRight(@YEAR, 2)

Share this post


Link to post
Share on other sites
mspoula

Manjish's example is much easier then your alternative. :)

$Date = @MONTH & "/" & @MDAY & "/" @ StringRight(@YEAR, 2)
AGREED I found it before reading his post. Thanks for the help.

Share this post


Link to post
Share on other sites
Manjish

shall we close this then??


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.