---------- Post updated at 10:34 AM ---------- Previous update was at 10:15 AM ----------
now iam stuck again !
perl is not translating the variable . without variable it gives me the correct date value but if i try to use a variable its giving me wrong values. ---------- Post updated at 10:35 AM ---------- Previous update was at 10:34 AM ----------
now iam stuck again !
perl is not translating the variable . without variable it gives me the correct date value but if i try to use a variable its giving me wrong values.
Last edited by Franklin52; 01-25-2012 at 03:56 AM..
Reason: Please use code tags for code and data samples, thank you
I have a file named "suspected" with series of line like these :
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Hi everybody,
I want to get the current time in epoch format (in UNIX or Korn Shell) and store it in a variable called
currentTime. Any response will be highly appreciated:)
Thanks in advance,
omoyne:D (8 Replies)
Hi,
Thanks bartus11 yesterday's code worked fine for me.
In meantime I've found another "issue".
As you can see highlighted, the time format in my original input in case of two rows which should be duplicited ,is differentwhat I need to do is to convert to this format "20110607-08:03:22"... (4 Replies)
Hi all ,
I need to know how to convert a time stamp entered by the user to be converted to GMT/UTC(epoch time) using mktime() and gmtime()
for exapample the input will be put in the form
ptm.tm_sec = 0;
ptm.tm_min = 59;
ptm.tm_hour = 11;
ptm.tm_mday = 20;... (2 Replies)
Looking for some help and usually when I do a search this site comes up. Hopefully someone can give me a little direction as to how to use one of these two commands to achieve what I'm trying to do.
What am I trying to do?
I need to take the time value in epoch format returned from the... (5 Replies)
# date +%s -d "Mon Feb 11 02:26:04"
1360567564
# perl -e 'print scalar localtime(1360567564), "\n";'
Mon Feb 11 02:26:04 2013
the epoch conversion is working fine. but one of my application needs 13 digit epoch time as input
1359453135154
rather than 10 digit epoch time 1360567564... (3 Replies)
I have a Raspberry Pi that logs some temperatures using Onewire. Data is collected with RRDTool.
The command sudo rrdtool fetch ute_temp.rrd AVERAGE -s -1h > ./test.log
and then cat test.log gives the result
1388608500: 2.3579639836e+00
.
How do I write a script that converts the Epoch time... (4 Replies)
Can someone help me to write a shell script to convert epoch timestamp into human readable format
1394553600,"test","79799776.0","19073982.728571","77547576.0","18835699.285714"
1394553600,"test1","80156064.0","19191275.014286","62475360.000000","14200554.720000"... (10 Replies)
I am trying to create a script that will take epoch (input from command line) and convert it into a readable format in bash/shell
---------- Post updated at 08:03 PM ---------- Previous update was at 07:59 PM ----------
#!bin/bash
read -p "Please enter a number to represent epoch time:"... (9 Replies)
Discussion started by: sprocket
9 Replies
LEARN ABOUT MOJAVE
date::format
Date::Format(3) User Contributed Perl Documentation Date::Format(3)NAME
Date::Format - Date formating subroutines
SYNOPSIS
use Date::Format;
@lt = localtime(time);
print time2str($template, time);
print strftime($template, @lt);
print time2str($template, time, $zone);
print strftime($template, @lt, $zone);
print ctime(time);
print asctime(@lt);
print ctime(time, $zone);
print asctime(@lt, $zone);
DESCRIPTION
This module provides routines to format dates into ASCII strings. They correspond to the C library routines "strftime" and "ctime".
time2str(TEMPLATE, TIME [, ZONE])
"time2str" converts "TIME" into an ASCII string using the conversion specification given in "TEMPLATE". "ZONE" if given specifies the
zone which the output is required to be in, "ZONE" defaults to your current zone.
strftime(TEMPLATE, TIME [, ZONE])
"strftime" is similar to "time2str" with the exception that the time is passed as an array, such as the array returned by "localtime".
ctime(TIME [, ZONE])
"ctime" calls "time2str" with the given arguments using the conversion specification "%a %b %e %T %Y
"
asctime(TIME [, ZONE])
"asctime" calls "time2str" with the given arguments using the conversion specification "%a %b %e %T %Y
"
MULTI-LANGUAGE SUPPORT
Date::Format is capable of formating into several languages by creating a language specific object and calling methods, see Date::Language
my $lang = Date::Language->new('German');
$lang->time2str("%a %b %e %T %Y
", time);
I am open to suggestions on this.
CONVERSION SPECIFICATION
Each conversion specification is replaced by appropriate characters as described in the following list. The appropriate
characters are determined by the LC_TIME category of the program's locale.
%% PERCENT
%a day of the week abbr
%A day of the week
%b month abbr
%B month
%c MM/DD/YY HH:MM:SS
%C ctime format: Sat Nov 19 21:05:57 1994
%d numeric day of the month, with leading zeros (eg 01..31)
%e like %d, but a leading zero is replaced by a space (eg 1..32)
%D MM/DD/YY
%G GPS week number (weeks since January 6, 1980)
%h month abbr
%H hour, 24 hour clock, leading 0's)
%I hour, 12 hour clock, leading 0's)
%j day of the year
%k hour
%l hour, 12 hour clock
%L month number, starting with 1
%m month number, starting with 01
%M minute, leading 0's
%n NEWLINE
%o ornate day of month -- "1st", "2nd", "25th", etc.
%p AM or PM
%P am or pm (Yes %p and %P are backwards :)
%q Quarter number, starting with 1
%r time format: 09:05:57 PM
%R time format: 21:05
%s seconds since the Epoch, UCT
%S seconds, leading 0's
%t TAB
%T time format: 21:05:57
%U week number, Sunday as first day of week
%w day of the week, numerically, Sunday == 0
%W week number, Monday as first day of week
%x date format: 11/19/94
%X time format: 21:05:57
%y year (2 digits)
%Y year (4 digits)
%Z timezone in ascii. eg: PST
%z timezone in format -/+0000
%d, %e, %H, %I, %j, %k, %l, %m, %M, %q, %y and %Y can be output in Roman numerals by prefixing the letter with "O", e.g. %OY will output
the year as roman numerals.
LIMITATION
The functions in this module are limited to the time range that can be represented by the time_t data type, i.e. 1901-12-13 20:45:53 GMT to
2038-01-19 03:14:07 GMT.
AUTHOR
Graham Barr <gbarr@pobox.com>
COPYRIGHT
Copyright (c) 1995-2009 Graham Barr. This program is free software; you can redistribute it and/or modify it under the same terms as Perl
itself.
perl v5.18.2 2009-12-12 Date::Format(3)