Author Topic: Custom date format for F9 shortcut  (Read 5635 times)

John Samuel

  • Newbie
  • *
  • Posts: 1
    • View Profile
Custom date format for F9 shortcut
« on: January 19, 2023, 21:33:00 »
Hi,

I need to change the date format for creating new folder with F7->F9 shortcuts, from YYYY-MM-DD to DD-MM-YY.

In help manual it's written as "F9 - Insert todays date as YYYY-MM-DD in the folder name field"

Thanks
John Samuel
« Last Edit: January 19, 2023, 22:12:30 by John Samuel »

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 527
  • Old Skull
    • View Profile
Re: Custom date format for F9 shortcut
« Reply #1 on: January 20, 2023, 17:45:26 »
You can create a User Defined Command of MultiScript type and bind it to a hotkey or insert it on QuickLaunch bar. The simple one could look like

Code: [Select]
@var $now = GetTime();
@var $date = FormatDate("dd-MM-yy" , $now);
@var $path = GetSourcePath() ^ $date;
MakeDir($path);

If you'd like to have different formats available.
Code: [Select]
@var $now = GetTime();
@var $options[];

arrayAdd( $options, FormatDate("dd-MM-yy" , $now) );
arrayAdd( $options, FormatDate("dd-MM-yyyy" , $now) );
arrayAdd( $options, FormatDate("yyyy_MM_dd" , $now) );
arrayAdd( $options, FormatDate("ddd MMM yyyy" , $now) );

@var $o = AskOption( "Make new dir: select date format", $options, 0 );
if( $o > -1 )
{
  @var $path = GetSourcePath() ^ $options[$o];
  MakeDir($path);
}