Software >> OS >> Unix >> Linux >> Shell >> How to assign date to a variable

!.bin/bash
var=$(date +%G-%m-%d_%H%M) 
echo $var