Sponsored Content
Operating Systems AIX convert a specific date to a unix timestamp Post 302605947 by omonoiatis9 on Friday 9th of March 2012 07:07:48 AM
Old 03-09-2012
this command doesnt seem to work for me.
i am using
Code:
echo <timestamp> | perl -e 'print localtime(<>) . "\n";'

to convert the timestamp into a human date.
but now i want to do the opposite, meaning converting a specific date into unix timestamp
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert from timestamp to date format in tcsh

hello all im looking for fast way to convert timestamp format to date format and vaiseversa in tcsh , can it be done? thanks allot (2 Replies)
Discussion started by: umen
2 Replies

2. Shell Programming and Scripting

Convert Unix Timestame to real timestamp

Hello, Did anyone know how to use script (e.g. perl) to conver Unix Timestame to real timestame in GMT+8 ? 1245900787 file:/tmp/a/Test/.txt.swp has created 1245900988 file:/tmp/a/Test/.txt.swp has changed Thu, 25 Jun 2009 11:33:07 GMT+8 file:/tmp/a/Test/.txt.swp has created Thu, 25 Jun... (4 Replies)
Discussion started by: happyday
4 Replies

3. Shell Programming and Scripting

To convert a date(in string format) to unix timestamp

Hi All, I have a string like below. "Mar 31 2009" . I want to convert this to unix time . Also please let me know how to find the unix time for the above string minus one day. For Eg. if i have string "Mar 31 2009" i want to find the unix time stamp of "Mar 30 2009". Thanks in advance,... (11 Replies)
Discussion started by: girish.raos
11 Replies

4. AIX

Change specific (not current) date to timestamp

Hello to all. I work at AIX system without perl installed and I am restricted user, so I am limited to bash. In script that I am writing, I have to read line from file and transform date that I found inside to Unix timestamp. Line in file look something like this: Tue Mar 29 06:59:00... (5 Replies)
Discussion started by: Hyperborejac
5 Replies

5. Shell Programming and Scripting

How to convert date and timestamp?

Hi, I have a file file1 having data as below 20110501,070742, ,012345678909,09999999999,68.5, 20110501,070236, ,089375855455,09376383333,374.3, 20110501,070525, ,090345895555,08444233444,206.2, 20110501,230051, ,000934744433,07624262223,480.1, First field is date(YYYYMMDD) and second... (5 Replies)
Discussion started by: vsachan
5 Replies

6. UNIX for Dummies Questions & Answers

How to convert R$Timestamp in Sql*Plus within a UNIX Shell Script?

I need to compare a R$Timestamp field sql within a Unix Shell Script. In straight SQL the following code works fine: Table Name: LL_UNIT_TRANSACTION UT Field: R$Timestamp Where TRUNC(UT.R$Timestamp) >= TRUNC(SYSDATE -7) the following returns no data within the Unix Shell Script... (2 Replies)
Discussion started by: Dapconsult
2 Replies

7. Shell Programming and Scripting

Convert UNIX timestamp to readable format in the file

Hello I have a file : file1.txt with the below contents : 237176 test1 test2 1442149024 237138 test3 test4 1442121300 237171 test5 test7 1442112823 237145 test9 test10 1442109600 In the above file fourth field represents the timestamp in Unix format. I found a command which converts... (6 Replies)
Discussion started by: rahul2662
6 Replies

8. Shell Programming and Scripting

AIX : Need to convert UNIX Timestamp to normal timestamp

Hello , I am working on AIX. I have to convert Unix timestamp to normal timestamp. Below is the file. The Unix timestamp will always be preceded by EFFECTIVE_TIME as first field as shown and there could be multiple EFFECTIVE_TIME in the file : 3.txt Contents of... (6 Replies)
Discussion started by: rahul2662
6 Replies

9. Shell Programming and Scripting

Convert date in dd mm yyyy format to UNIX timestamp

Hello All, I have a date in DD/MM/YYYY format. I am trying to convert this into unix timestamp. I have tried following: date -d $mydate +%s where mydate = 23/12/2016 00:00:00 I am getting following error: date: extra operand `+%s' Try `date --help' for more information. ... (1 Reply)
Discussion started by: angshuman
1 Replies

10. Shell Programming and Scripting

Convert Timestamp in text to Serial Date-Time

Hi, I have a data file where the timestamp is in the style of: 2016-10-11 07:01:23.375-500 which is yyyy-mm-dd hh-mm-ss-000 then time conversion from UTC What i need to do is convert these timestamps from the above format to a the Serial Date format (i.e 42,654.2920446 ) now.. if... (14 Replies)
Discussion started by: AshBax
14 Replies
utc(1m) 																   utc(1m)

NAME
utc - A dcecp object that manipulates UTC timestamps SYNOPSIS
utc add timestamp relative_timestamp utc compare absolute_timestamp absolute_timestamp [-noinaccuracy] utc convert absolute_timestamp [-gmt] utc help [operation | -verbose] utc multiply relative_timestamp {integer | floating_point_factor} utc operations utc subtract timestamp timestamp ARGUMENTS
An International Organization for Standardization (ISO) compliant time format of the following form: CCYY-MMDD- hh:mm:ss.fff[+|-]hh:mmIsss.fff The Time Differential Factor (TDF) component [+|-]hh.mm, if present, indicates the offset from Universal Time Coordinated (UTC) time and implies local system time. The inaccuracy component Iss.fff, if present, specifies the duration of the time interval that contains the absolute time. A floating-point number such as 53.234. A whole number such as 79. The name of the utc operation for which to display help information. A Distributed Time Service (DTS) timestamp of the following form: [-]DD-hh:mm:ss.fff- Iss.fff Relative times often omit fractions of seconds (the leftmost .fff sequence) and generally lack an inaccuracy component (Iss.fff). For example, a relative time of 21 days, 8 hours, and 15 minutes is expressed as 21-08:15:00. A utc timestamp that can be a relative or absolute time. See the relative_timestamp and absolute_timestamp argument descriptions for the format of these timestamps. DESCRIPTION
The utc object lets you add, compare, and convert timestamps in DTS and ISO formats. OPERATIONS
utc add Adds two timestamps. The syntax is as follows: utc add timestamp relative_timestamp The add operation returns the sum of two timestamps. The timestamps can be two relative times or an absolute time and a relative time. Privileges Required No special privileges are needed to use the utc add command. Examples dcecp> utc add 1994-10-18-13:21:50.419-04:00I----- +0-00:02:00.000I----- 1994-10-18-13:23:50.419-04:00I----- dcecp> utc compare Compares two absolute timestamps indicating the temporal order. The syntax is as follows: utc compare absolute_timestamp absolute_time- stamp [-noinaccuracy] The compare operation compares two timestamps and returns -1 if the first is earlier, 1 if the second is earlier, and 0 if the difference is indeterminate. Specify the -noinaccuracy option to ignore inaccuracies in comparisons; in this case a return of 0 indicates the times are the same. Privileges Required No special privileges are needed to use the utc compare command. Examples dcecp> utc compare 1994-10-18-13:22:32.816-04:00I----- > 1994-10-18-13:21:50.419-04:00I----- -noinaccuracy 1 dcecp> utc convert Converts a timestamp from UTC to local time. The syntax is as follows: utc convert absolute_timestamp [-gmt] The convert operation accepts a timestamp and returns another timestamp that expresses the same time in the local time zone. If called with the -gmt option it returns a Greenwich mean time (GMT) formatted timestamp. Privileges Required No special privileges are needed to use the utc convert command. Examples dcecp> utc convert 1994-10-18-13:22:32.816-00:00I----- 1994-10-18-09:22:32.816-04:00I----- dcecp> dcecp> utc convert 1994-10-18-13:22:32.816-00:00I----- -gmt 1994-10-18-13:22:32.816I----- dcecp> utc help Returns help information about the utc object and its operations. The syntax is as follows: utc help [operation | -verbose] Options Displays information about the utc object. Used without an argument or option, the utc help command returns brief information about each utc operation. The optional operation argu- ment is the name of an operation about which you want detailed information. Alternatively, you can use the -verbose option for more detailed information about the utc object itself. Privileges Required No special privileges are needed to use the utc help command. Examples dcecp> utc help add Adds a relative and absolute, or two relative, timestamps. compare Compares two timestamps to determine which is earlier. convert Converts a timestamp into the local timezone or GMT. multiply Multiplies a relative timestamp by a number. subtract Returns the difference between two timestamps. help Prints a summary of command-line options. operations Returns a list of the valid operations for this command. dcecp> utc multiply Multiplies a relative time (a length of time) by an integer or floating-point factor. The syntax is as follows: utc multiply rela- tive_timestamp {integer | floating_point_factor} The multiply operation accepts two arguments: a relative timestamp and an integer or floating-point factor. It multiplies the length of time (specified by the relative timestamp) by the integer or floating-point factor, returning the product as a relative timestamp. Privileges Required No special privileges are needed to use the utc multiply command. Examples dcecp> utc multiply +0-00:00:05.000I----- 3 +0-00:00:15.000I----- dcecp> utc operations Returns a list of the operations supported by the utc object. The syntax is as follows: utc operations The list of available operations is in alphabetical order except for help and operations, which are listed last. Privileges Required No special privileges are needed to use the utc operations command. Examples dcecp> utc operations add compare convert multiply subtract help operations dcecp> utc subtract Subtracts one timestamp from another, returning the difference as a relative timestamp. The syntax is as follows: utc subtract timestamp timestamp The subtract operation returns the difference between two timestamps that express either an absolute time and a relative time, two relative times, or two absolute times. Subtracting an absolute timestamp from a relative timestamp, however, is not allowed. The return value is an absolute or relative timestamp, depending on how the command is used. Privileges Required No special privileges are needed to use the utc subtract command. Examples dcecp> utc subtract 1994-10-18-13:22:32.816-00:00I----- +0-00:00:15.000I----- 1994-10-18-13:22:17.816+00:00I----- dcecp> RELATED INFORMATION
Commands: dcecp(1m), dcecp_clock(1m), dcecp_dts(1m), dtsd(1m). utc(1m)
All times are GMT -4. The time now is 07:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy