Hi Everyone,
Is there a Unix command to print the date as an integer?
Thanks
Printable View
Hi Everyone,
Is there a Unix command to print the date as an integer?
Thanks
E <en@no.spam.com> wrote:[color=blue]
> Is there a Unix command to print the date as an integer?[/color]
Yes.
Look for the explanation of the "+-sign" in the date(1) manual page.
- Philip
--
Philip Paeps Please don't email any replies
[email]philip@paeps.cx[/email] I follow the newsgroup.
<NQBW> ptc1: you shall be first against the wall when the revolution comes
Philip Paeps <philip+usenet@paeps.cx> wrote:
+---------------
| E <en@no.spam.com> wrote:
| > Is there a Unix command to print the date as an integer?
|
| Yes.
| Look for the explanation of the "+-sign" in the date(1) manual page.
+---------------
Which redirects one to "strftime(3)", where one finds "%s".
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
Rob Warnock <rpw3@rpw3.org> wrote:[color=blue]
> Philip Paeps <philip+usenet@paeps.cx> wrote:
> +---------------
>| E <en@no.spam.com> wrote:
>| > Is there a Unix command to print the date as an integer?
>|
>| Yes.
>| Look for the explanation of the "+-sign" in the date(1) manual page.
> +---------------
>
> Which redirects one to "strftime(3)", where one finds "%s".[/color]
Yes.
- Philip
--
Philip Paeps Please don't email any replies
[email]philip@paeps.cx[/email] I follow the newsgroup.
<nqbw> Kitty: Yes, I watched 'Preaching to the Perverted'.
<nqbw> I knew that film was sado-masochistic when I first noticed it was
in NTSC format.
On Wed, 30 Jul 2008 10:58:36 UTC, E <en@no.spam.com> wrote:
[color=blue]
> Hi Everyone,
>
> Is there a Unix command to print the date as an integer?[/color]
date "+%s"
You didn't say what the integer had to represent - that one is seconds
since the epoch.
--
Bob Eager
UNIX since v6..
[url]http://tinyurl.com/2xqr6h[/url]
Bob Eager wrote:[color=blue]
> On Wed, 30 Jul 2008 10:58:36 UTC, E <en@no.spam.com> wrote:
>[color=green]
>> Hi Everyone,
>>
>> Is there a Unix command to print the date as an integer?[/color]
>
> date "+%s"
>
> You didn't say what the integer had to represent - that one is seconds
> since the epoch.
>[/color]
I believe that is what I was looking for. The "%s" wasn't clear in the
man page I was reading, but I found it.
Thanks much
Eric
Bob Eager wrote:[color=blue]
> On Wed, 30 Jul 2008 10:58:36 UTC, E <en@no.spam.com> wrote:
>[color=green]
>> Hi Everyone,
>>
>> Is there a Unix command to print the date as an integer?[/color]
>
> date "+%s"
>
> You didn't say what the integer had to represent - that one is seconds
> since the epoch.
>[/color]
Is there a flag to also obtain the milliseconds?
Eric
On Fri, 01 Aug 2008 11:03:58 -0400, Eric <en@no.spam.com> wrote:[color=blue]
>
> Is there a flag to also obtain the milliseconds?[/color]
You get what's available as documented in strftime(3) -- as date(1)
tells you. So if it's not in there, then no, it's not available.
If you really need mili- or microseconds then you can get them through
a small program in C or perl or whichever language you choose using the
relevant system call[1], though program start/stop overhead means the
numbers won't be accurate anyway.
What do you need it for? There may be better approaches available.
[1] gettimeofday(2) See also clocks(7) for more information about what
sort of time counters are available.
--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
This message was originally posted on Usenet in plain text.
Any other representation, additions, or changes do not have my
consent and may be a violation of international copyright law.