converting localtime to unixtime

hi,

how to convert the localtime to unixtime?

i have date from the date command in unix

i want to convert it into unixtime

thnx

Your question is somewhat unclear. If you mean by "unixtime" the numbers of seconds since the UNIX epoch i.e. the nunber of seconds since 1970-01-01 00:00:00 UTC, most date commands support the %s formatting option to display the numbers of seconds. Some support a -u option to do the same thing.

Maybe he means GMT:

csadev:/home/jmcnama> echo $TZ
CST6CDT
csadev:/home/jmcnama> TZ=GMT0
csadev:/home/jmcnama> date
Tue Oct 30 14:20:24 GMT 2007
csadev:/home/jmcnama> TZ=CST6
csadev:/home/jmcnama> date
Tue Oct 30 08:20:39 CST 2007
csadev:/home/jmcnama>TZ=CST6CDT

You can change your timezone setting to GMT0 and then back to where it was.
"date" then shows what the time is in various timeszones.