UNIX timestamp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX timestamp
# 8  
Old 12-16-2015
Not able to print variable

Hi
I am not able to print value in mac ,Can you please help
Based on the below command ,i need to print the value and that value assign to next one

Code:
folder=`date -uj +%s000 $(date -u +%m%d0000%Y)` ==>some number value

folder="s3://xx/segment-logs/$folder"
echo $folder

Thanks,
Mohan

Last edited by jim mcnamara; 12-16-2015 at 10:41 PM.. Reason: code tags
# 9  
Old 12-16-2015
Its not possible through linux
# 10  
Old 12-16-2015
I don't have access to a Linux system, but the following should be a reasonable translation of the code Scrutinizer suggested for OS X into something Linux system date utilities should be able to handle:
Code:
date -u -d "$(date -u "+%a %b %e 00:00:00 %Z %Y")" +%s000

# 11  
Old 12-16-2015
You could try:

Code:
$ date -u -d "$(date -d 00:00)" +%s000
1450310400000

or even
Code:
$ date -u -d "$(date -d 0)" +%s000
1450310400000

# 12  
Old 12-16-2015
There are multiple errors in the first line
Code:
1/ j is not a valid option
2/ The second $ date ...) is being treated as an illegal option

So, please tell us what you are trying to do. Not how you expect/want to do it. That has problems.
# 13  
Old 12-16-2015
Hi ,
In S3 bucket files going to store as unix time stamp as folder in daily bases ,i want to automate from shell script .My script need to take the today date convert into unix time stamp and extract those files only
# 14  
Old 12-17-2015
Moderator's Comments:
Mod Comment There seem to be two threads discussing the same topic. And, neither one of them gives a clear description of the problem. One says that there is a problem on a Mac (which we would assume is running OS X) and the other says there is a problem on Linux. But the pathname being created appears to be a Windows (not OS X and not Linux) pathname.

I have merged these two discussions into the original thread and hope that the original poster will clarify what the real requirements are by specifying what operating system and shell are being used (as has been asked in both of the original threads), and showing us the results of the attempts that have been made instead of just showing us code and saying "it doesn't work".
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Check if a string is a valid timestamp in UNIX.

Hi all, I have date and time value in a string, I want to check if it is a valid date and time. Need help on this. Thanks (7 Replies)
Discussion started by: Pratiksha Mehra
7 Replies

3. Shell Programming and Scripting

TimeStamp to unix time

Hi, is there a way to get unix time from timestamp using date function in unix/ OS: SunOS 5.10 input : 2012-07-26 15:00:00 output: 1343314800Thanks in advance (6 Replies)
Discussion started by: sol_nov
6 Replies

4. UNIX for Dummies Questions & Answers

Unix timestamp to readable date

How would I convert a unix timestamp such as "1232144092" to a readable date such as "1/16/2009 10:14:28 PM" ? I thought I could use date, but I don't think so now.. Any help would be great!! (4 Replies)
Discussion started by: Rhije
4 Replies

5. UNIX for Advanced & Expert Users

AIX/awk date to unix timestamp

Hello, I am inside a awk script on AIX, I am feeding to awk ls -luNR i need to convert ls -u time format "month day h:m/yr" to Unix epoch time, POSIX time, or aka unix timestamp I do not have strftime funk in my awk, and i have to do this fast meaning that I cannot do a system call in the... (1 Reply)
Discussion started by: nullwhat
1 Replies

6. AIX

unix timestamp

hi, i have heard that date and time stamp are stored somewhere in unix as an interger. suppose May 20 07:05:59 is stored as 12342234 can anyone tell me where to find this integer. (9 Replies)
Discussion started by: ali560045
9 Replies

7. Programming

converting unix timestamp into readable format using c++

hi everyone, im new here and am in desperate need of help. I want to convert my 32 bit unix time stamp ' 45d732f6' into a readable format (Sat, 17 February 2007 16:53:10 UTC) using c++. I have looked around the interent but i just cant make sense of anything. All examples i can find just... (3 Replies)
Discussion started by: uselessprog
3 Replies

8. AIX

get unix timestamp

How can I get the unix timestamp from AIX? (6 Replies)
Discussion started by: psimoes79
6 Replies

9. UNIX for Advanced & Expert Users

FTP from windows to Unix maintaining timestamp

Hi, Is it possible to Ftp the files from Windows to Unix while maintaining their timestamp Gaurav (1 Reply)
Discussion started by: gauravgoel
1 Replies

10. UNIX for Dummies Questions & Answers

display the timestamp of a server UNIX

I can't find the command shell UNIX to display the timestamp of the current date. It's not an option of the commande date. (3 Replies)
Discussion started by: nicolas
3 Replies
Login or Register to Ask a Question