Skip to content

Get Unix Format Time on Solaris

Getting Unix Format Time on Solaris

Here is a little script to obtain Unix format on Solaris (Epoch Time):

1
2
3
#!/bin/sh
/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'
exit $?

And finally, let's see it in action:

# ./edate
1149276150