Sponsored Content
Top Forums Shell Programming and Scripting To convert a date(in string format) to unix timestamp Post 302350516 by girish.raos on Friday 4th of September 2009 06:36:24 AM
Old 09-04-2009
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,
Giri

---------- Post updated at 05:36 AM ---------- Previous update was at 04:56 AM ----------

Can anyone please respond for this ?
Thanks,
Giri
 

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 date to readable format

Dear Experts, I need your help to convert a unix date and time format number in to readable format like dd/mm/yyyy . I have a text file of more than 10,000 records and it is like NAME DATE1 COUNTRY DATE2 ABD 1223580395699 USA 1223580395699... (3 Replies)
Discussion started by: shary
3 Replies

3. AIX

Convert unix timestamp to year month day format ?

Hello, How do I convert unix timestamp value to 'normal' date format - to get year month and day values ? Looks like it's easy to do using GNU date (linux systems). But how do I do tthis on AIX ? I don't want to write C program, any ways to do that using unix shells ? thanks (1 Reply)
Discussion started by: vilius
1 Replies

4. Shell Programming and Scripting

Convert date to Unix format

Dear Expert How to convert date in format of YYYY-MM-DD HH:MM:SS to unix format using a script or command if avaliable Example "2011-05-15 18:00:00" is converted to 1330970400 I tried to use option d in date command but no use, Im using solaris 10 Thanks a lot (12 Replies)
Discussion started by: yahyaaa
12 Replies

5. AIX

convert a specific date to a unix timestamp

hello, i have an AIX5.3 machine and i am writing a script to display some processes. inside the script i want to get the time that the process starts and convert it to a unix timestamp. is there a command that i can use to do that? i search the web but all i found is long scripts and it does... (4 Replies)
Discussion started by: omonoiatis9
4 Replies

6. Shell Programming and Scripting

Convert string into date format

Hi, I am getting the below string as a input for date. 12/03/2013 11:02 AM I want to change this date as 03-DEC-2013 11:02 AM. Could you please help on this. Thanks Chelladurai (4 Replies)
Discussion started by: ckchelladurai
4 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

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

9. Shell Programming and Scripting

Convert string (YYYYMMDD) format to date in Sun OS

Hi All I need help in converting a string of YYYYMMDD format to date in Sun OS and then find out if the day is a Wednesday or not. The "date -d" option is not working and your help is much appreciated. The date command usage from the operating system we use here is as follows: usage: ... (1 Reply)
Discussion started by: SK123
1 Replies

10. Solaris

Convert string (YYYYMMDD) format to date in Sun OS

Hi All I need help in converting a string of YYYYMMDD format to date in Sun OS and then find out if the day is a Wednesday or not. The "date -d" option is not working and your help is much appreciated. The date command usage from the operating system we use here is as follows: Thanks, SK (11 Replies)
Discussion started by: SK123
11 Replies
PMPARSECTIME(3) 					     Library Functions Manual						   PMPARSECTIME(3)

NAME
__pmParseCtime - convert ctime(3) string to tm structure C SYNOPSIS
#include <pcp/pmapi.h> #include <pcp/impl.h> int __pmParseCtime(const char *string, struct tm *rslt, char **errmsg); cc ... -lpcp DESCRIPTION
__pmParseCtime reverses the asctime(3C) function. It accepts a string specifying a time, and fills in the given tm structure. Either a fully specified asctime(3C) string like "Mon Mar 4 13:07:47 1996" or a partially specified time like '1996", "Mar 1996", "Mar 4 1996", "Mar", "13:07:47", "13:07", "Mar 4 13:07:47",... is accepted. In addition, the seconds component may be a floating point number, for example "13:07:47.5". The 12 hour clock is also supported, so "13:07" and "1:07 pm" are equivalent. __pmParseCtime returns 0 if successful. It returns -1 and a dynamically allocated error message string in errmsg, if the given string does not parse. Be sure to free(3C) the error message string. The tm structure returned in rslt should only be used as an argument to the __pmConvertTime function, as it contains encoded information that will only be correctly interpreted by __pmConvertTime. SEE ALSO
PMAPI(3), pmParseInterval(3), __pmConvertTime(3) and __pmParseTime(3). Performance Co-Pilot PCP PMPARSECTIME(3)
All times are GMT -4. The time now is 08:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy