|
|
changing date format in solaris 9
Hi all,
I would like to chage to date format of solaris to the form "YYYY-MM-DD
hh:mm:ss�oo:oo" where the oo:oo represents the offset to GMT.
For eg. 2005-05-29 10:16:10+05:30
I am trying to change the LC_TIME variable, but not sure on what to set.
How do I achieve this?
Thanks
__jakal__
|
|
0
|
|
|
|
Reply
|
__jakal__
|
3/29/2005 3:17:28 PM |
|
Don't know that you can do this with locale, but an alias or wrapper
that does the following should work:
#!/bin/sh
exec /bin/date ${@-+"%Y-%m-%e %H:%M:%S%z"}
Not sure if /bin/date on sol9 supports the same formatting options,
but if not, gnu date does.
- Bob
__jakal__ wrote:
> Hi all,
> I would like to chage to date format of solaris to the form "YYYY-MM-DD
> hh:mm:ss�oo:oo" where the oo:oo represents the offset to GMT.
> For eg. 2005-05-29 10:16:10+05:30
>
> I am trying to change the LC_TIME variable, but not sure on what to set.
|
|
0
|
|
|
|
Reply
|
Robert
|
3/29/2005 4:30:00 PM
|
|
Not as concise as it could be, but more robust than my earlier suggestion...
#!/bin/sh
args=${@-+"%Y-%m-%e %H:%M:%S%z"}
exec /bin/date "$args"
- Bob
__jakal__ wrote:
> Hi all,
> I would like to chage to date format of solaris to the form "YYYY-MM-DD
> hh:mm:ss�oo:oo" where the oo:oo represents the offset to GMT.
> For eg. 2005-05-29 10:16:10+05:30
>
> I am trying to change the LC_TIME variable, but not sure on what to set.
>
> How do I achieve this?
>
> Thanks
> __jakal__
|
|
0
|
|
|
|
Reply
|
Robert
|
3/29/2005 5:03:10 PM
|
|
__jakal__ wrote:
> I would like to chage to date format of solaris to the form "YYYY-MM-DD
> hh:mm:ss�oo:oo" where the oo:oo represents the offset to GMT.
> For eg. 2005-05-29 10:16:10+05:30
That's a funny time format. It's *almost* the same as ISO, but not
quite. If you're going to do something that's almost ISO, why not
just do real ISO?
By the way, you can get the ISO time from GNU date with "date -Iseconds".
- Logan
|
|
0
|
|
|
|
Reply
|
Logan
|
3/29/2005 8:05:58 PM
|
|
|
3 Replies
500 Views
(page loaded in 0.056 seconds)
|
|
|
|
|
|
|
|
|