Help with Date Formats


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help with Date Formats
# 1  
Old 06-02-2009
Help with Date Formats

Hi,

Following are the results of various date formats:

1. date +%h" "%d
Result: Jun 02

2. date
Result: Tue Jun 2 09:59:15 CDT 2009

If i use the date format as date +%h%d then i am getting the date as 02. I want the day to be displayed as "2" instead of "02".

so my result should be Jun 2 instead of Jun 02.

How can we do this?

Thanks
Sandeep
# 2  
Old 06-02-2009
'man strftime' yields:
Code:
     %e    Day of month [1,31]; single digits are preceded  by  a
           space.

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using gsub with xml formats

Hello, I'm looking again for your precious help. I'm running an IBM AIX box. I have 'wrong' xml files and waiting for the bug correction I need to manipulate them The problem is a missing tag. Now you know that xmls are full of < and > and \ so our scripts just go beserk. To be on the... (3 Replies)
Discussion started by: emare
3 Replies

2. Shell Programming and Scripting

Comparing different time formats

I am trying to do a comparison of files based on their last modified date. I am pulling the first file from a webapp folder using curl. curl --silent -I http://localhost:8023/conf/log4j2.xml | grep Last Last-Modified: Tue, 22 Mar 2016 22:02:18 GMT The second file is on local disk. stat... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

3. Shell Programming and Scripting

How to compare dates in different formats?

Hi, I have a log file that records date time stamp in this format <Jun 7, 2015 12:56:54 PM EDT>. The date command give me the date in this format Mon Jun 8 08:40:58 EDT 2015 If the difference in the timestamp in the logfile & the current System datetime stamp is less than 15 mins then... (4 Replies)
Discussion started by: shifahim
4 Replies

4. Shell Programming and Scripting

Need to check the file formats

Hi, I want to check the incoming files whether the file is Mac file or dos/windows file in unix shell script. Sometimes client is posting Mac file and sometimes it is dos file. Could you please help me how to determine/check whether the file is Mac or dos. Help in advance Thanks (4 Replies)
Discussion started by: lkeswar
4 Replies

5. Shell Programming and Scripting

Output with horizontal formats

// AIX 5.3 & 6.1 This command powermt display dev=all returns the output of Pseudo name=hdiskpower50 Symmetrix ID=000190101757 Logical device ID=05F0 state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ==============================================================================... (2 Replies)
Discussion started by: Daniel Gate
2 Replies

6. Shell Programming and Scripting

Extracting data from a log file with date formats

Hello, I have a log file for the year, which contains lines starting with the data in the format of YYYY-MM-DD. I need to get all the lines that contain the DD being 04, how would I do this? I tried using grep "*-*04" but it didn't work. Any quick one liners I should know about? Thank you. (2 Replies)
Discussion started by: cpickering
2 Replies

7. Shell Programming and Scripting

Converting date string to different formats

Sucks to be a noob :o See my last post for solution I have 3 different log formats and the filenames contain a date. I am trying to write a script to grep these files between two date ranges. I am now stuck at the date conversion bit. I let the user entered a date string in the format... (6 Replies)
Discussion started by: GermanJulian
6 Replies

8. Shell Programming and Scripting

Passing date formats in Perl: i.e. Jul/10/2007 -> 20070710 (yyyymmdd) - Perl

Hi , This script working for fine if pass script-name.sh Jul/10/2007 ,I want to pass 20070710(yyyymmdd) .Please any help it should be appereciated. use Time::Local; my $d = $ARGV; my $t = $ARGV; my $m = ""; @d = split /\//, $d; @t = split /:/, $t; if ( $d eq "Jan" ) { $m = 0 }... (7 Replies)
Discussion started by: akil
7 Replies

9. Solaris

different date formats in same server

when I ssh and run date command, it shows date in 24 hour date format. But when I telnet the same server, it shows date in 12 hour format, ie. in AM/PM (1 Reply)
Discussion started by: na75369
1 Replies

10. UNIX for Dummies Questions & Answers

date formats

Hi, I want to generate file name in the following date format, "YYYYMMDDHHHHMISS" plz. help me how to do that? (6 Replies)
Discussion started by: harshad.katruwa
6 Replies
Login or Register to Ask a Question