bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Military time


From: Paul Eggert
Subject: Re: Military time
Date: 17 Aug 2003 21:12:48 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

C C Magnus Gustavsson <address@hidden> writes:

> I would like date (or rather strftime()) to be able to use letter
> abbreviations for time zones ("military time").

Can't you implement it fairly easily with a C function or shell
script?  Here's a shell script, for example:

#! /bin/sh

set $(date +'%Y-%m-%d %H:%M:%S %z')

case $3 in
-1200) z=Yankee;;
-1100) z=X-ray;;
-1000) z=Whiskey;;
-0900) z=Victor;;
-0800) z=Uniform;;
-0700) z=Tango;;
-0600) z=Sierra;;
-0500) z=Romeo;;
-0400) z=Quebec;;
-0300) z=Papa;;
-0200) z=Oscar;;
-0100) z=November;;
+0000) z=Zulu;;
+0100) z=Alpha;;
+0200) z=Bravo;;
+0300) z=Charlie;;
+0400) z=Delta;;
+0500) z=Echo;;
+0600) z=Foxtrot;;
+0700) z=Golf;;
+0800) z=Hotel;;
+0900) z=India;;
+1000) z=Kilo;;
+1100) z=Lima;;
+1200) z=Mike;;
*)
  # The current time zone has a value like +1400 or +0530
  # that cannot be represented in military time.
  z='no military abbreviation';;
esac

echo "$1 $2 $3 ($z)"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]