Which is the STRING format in the date command?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Which is the STRING format in the date command?
# 1  
Old 03-19-2009
Which is the STRING format in the date command?

Hi

According with the 'date' command documentation
Quote:
-d, --date=STRING
display time described by STRING, not `now'
My question is, which are the possible values for STRING? I have been looking in the man pages but I didn't find anything?

After some googling I have found it can have special values as 'now', 'yesterday' or 'tomorrow'. If it represents a date, in which format? mm/dd/yyyy HH:MM:SS? yyyy-mm-dd HH:MM:SS? Where is this feature documented?

Thanks a lot

Isi

Last edited by rbatte1; 08-03-2016 at 08:47 AM.. Reason: Quoted quoted quote
# 2  
Old 03-19-2009
Code:
zsh-4.3.9[radoulov]% date -d '4 FEB 1974' +'%A, %d %B %Y'
Monday, 04 February 1974

For more information:

Code:
man date|less -p'FORMAT '

You can find some examples in the info pages.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

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

3. Shell Programming and Scripting

Show the string in date format

Hello guys. how can print the: 20140206 like Fri, Feb 6, 2015 Thank you. (4 Replies)
Discussion started by: Ymir
4 Replies

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

5. Shell Programming and Scripting

Compare Date with String in date format

Hi, I am new to this forum, searched, but for some reason did not find much help, so a new thread. I am trying to compare date with a string which is in date format , but for some reason, system does not give me the right result. Date is coming in a file and i am comparing the same with... (2 Replies)
Discussion started by: mkstool
2 Replies

6. Shell Programming and Scripting

Date format check and replace string in PERL

I have got few date format patterns like "yyyymmdd", "yy_mm_dd" etc. There can be any combination of such patterns. I have used add_delta_days to find "yyyy", "yy", "mm", "dd" for the current date and saved them to different variables like "$y1", "$y2", "$m1" etc In one line, i want to... (10 Replies)
Discussion started by: irudayaraj
10 Replies

7. Shell Programming and Scripting

How to format string/date in bash?

I have string like "1-JUN-11" and it needs to be converted to "01JUN11" and "1/6/2011":confused::confused::confused: Thanks (2 Replies)
Discussion started by: ford99
2 Replies

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

9. Shell Programming and Scripting

How to search a date format from a file an replace with a string in PERL

I am very new to Perl. I am struggling so hard to search a date (such as 10/09/2009, 10-09-2009) from a text file and replace with a string (say DATE) using Perl. Please help me out. Thanks in advance. Regds Doren (4 Replies)
Discussion started by: my_Perl
4 Replies

10. UNIX for Dummies Questions & Answers

How to format a date string

I have a file tmp.out with contents: 20080812 02:41:07 20080812 05:03:04 20080812 05:46:16 How do I format the contents such as: 2008-08-12 02:41:07 2008-08-12 05:03:04 2008-08-12 05:46:16 Thanks, - CB (2 Replies)
Discussion started by: ChicagoBlues
2 Replies
Login or Register to Ask a Question