Wednesday, August 31, 2011

Windows does not have unixtime. :(

I like my Mac. I like unixtime. It helps keep me organized, but I was surprised to find that Windows does not have a similar feature from the shell. I did find that I could generate unix-like time, which made me happy. :)

In a batch file, can do substrings that can be used to generate new date information.
My batch file sui.sh was:
echo %date% %time%
echo %date:~-4,4%%date:~-10,2%%date:~-7,2%.%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%

The output produced:
Tue 08/30/2011 11:28:31.09
20110830.11283109

Happy, happy sui. :)

No comments:

Post a Comment