The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Convert UTC time to Date GNMIKE Shell Programming and Scripting 10 05-08-2009 08:07 AM
Convert Epoch Time to Standard Date and Time & Vice Versa DrivesMeCrazy Shell Programming and Scripting 5 02-07-2009 01:40 AM
Convert Epoch time format to normal date time format in the same file rk4k Shell Programming and Scripting 3 11-19-2008 10:04 PM
convert unix date to readable format shary Shell Programming and Scripting 3 10-15-2008 03:16 AM
Convert String to Date Unix sameerspice Shell Programming and Scripting 4 09-17-2008 08:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-20-2009
funksen funksen is online now Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 431
Convert date to unix time

Hi, I need to convert a date in the format

yyyy-mm-dd to unix seconds, shell script or perl would be ok

since there is no hour/second, we can assume 12am every day


thanks in advance

funksen
  #2 (permalink)  
Old 03-20-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,771
Are you on Linux - ie., do you have GNU date?
  #3 (permalink)  
Old 03-23-2009
funksen funksen is online now Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 431
hi jim,

I am on rhel 4 and have gnu date

cheers
  #4 (permalink)  
Old 03-23-2009
pludi's Avatar
pludi pludi is online now Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,891
Code:
$ date -d "2009-03-23" +%s
1237762800
$ date +"%X %F" -d @1237762800
00:00:00 2009-03-23
$
  #5 (permalink)  
Old 03-23-2009
funksen funksen is online now Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 431
great, thank you
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:06 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0