Jump to content


Help with FormatTime


  • Please log in to reply
3 replies to this topic

#1 Aldox

Aldox
  • Guests

Posted 11 August 2012 - 11:33 AM

I have this script here wish I use very often

!1::
FormatTime, CurrentDateTime,, d/M/yyyy HH:mm tt
SendInput %CurrentDateTime%
return

But i'm wondering, is it possible to set the Date to like the first day of the next month from today instead of the current date? I mean if today it is 11.08.2012 the code would show 01.09.2012

#2 dmg

dmg
  • Members
  • 1737 posts

Posted 11 August 2012 - 12:46 PM

FormatTime by itself cannot do that, I don't think. But this script should do what you ask:
!1::
FormatTime, CurrentMonth, , M
FormatTime, CurrentDateTime, , yyyy HH:mm tt
if (CurrentMonth = 12)
 {
   NextMonth := 01
 }
else
 {
   NextMonth := CurrentMonth+1
 }
SendInput, 01/%NextMonth%/%CurrentDateTime%
return
This just splits the task up so a bit of math can be applied to the month.

By the way, this time format: HH:mm tt will display the time in 24 hour (military) format, but it also displays AM and PM. It seems a little unusual to use both at the same time. :shock:

#3 Guests

  • Guests

Posted 11 August 2012 - 02:54 PM

I know :? hehe, it doesn´t show on my PC anyway so I just left the
tt
stay there anyway ^^but you got a point there :p

#4 HotKeyIt

HotKeyIt
  • Fellows
  • 6119 posts

Posted 12 August 2012 - 01:59 AM

!1::

FormatTime,CurrentDateTime,% A_YYYY+(A_MM=12?1:0) . (A_MM=12?"01":A_MM+1) . "010000", d/M/yyyy HH:mm tt

MsgBox %CurrentDateTime%

return