Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch command for geting date in specified format

Is it possible to specify date format (maybe as paramater or some similar way) which batch command date returns or it only depends on windows regional settings? What I would like is to somehow specify date format when i call date so that the batch script can extract day, month and year and save them in variables. The problem is that some machines return dd/MM/yyyy and some MM/dd/yyyy so in one case day and month would be switched. Some also use dots as separators. Can I somehow tell date to return for example MM/dd/yyyy so I can differentiate which is day and which is month?

like image 599
ValentQ Avatar asked Jul 02 '26 12:07

ValentQ


1 Answers

I am not sure if these will definitely resolve your issue, but please take a look at Date and Time functions on link http://commandline.co.uk/lib/treeview/index.php.

like image 159
Parag Doke Avatar answered Jul 05 '26 02:07

Parag Doke