Sign in to follow this  
Followers 0
mspoula

Getting the Year as two digits

6 posts in this topic

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



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

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

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

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

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  
Followers 0