Go Back   Linux Forums by TotalPenguin! Get linux Help! > GUI Linux > Linux Programming and Scripting > Shell Scripts

Shell Scripts Post your shell script and what it does here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-18-2008, 06:07 PM
Tor Tor is offline
Senior Member
 
Join Date: Oct 2007
Posts: 364
Tor is on a distinguished road
Default Shell Script Date YYYYMMDD Format

I just spent 30 minutes finding this information so I thought I would post it. If you need the date and time in a shell script with YYYYMMDD format and HHMM format here is the script commands:

Code:
TIME=$(date +%k%M)
DAY=`/bin/date +%Y%m%d`
Output:
Code:
1305
20080818

Last edited by Tor; 08-18-2008 at 06:24 PM.
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-20-2008, 06:03 AM
Super Moderator
 
Join Date: Dec 2007
Location: Denmark
Posts: 273
v0id is on a distinguished road
Send a message via MSN to v0id
Default

The man-page of date has all the specifiers listed.
Reply With Quote
  #3 (permalink)  
Old 08-27-2008, 03:01 AM
Tor Tor is offline
Senior Member
 
Join Date: Oct 2007
Posts: 364
Tor is on a distinguished road
Default

It does, so you can use the man page and change the above script as you need.
Reply With Quote
Reply

Tags
date, time

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Log a script contents Hektor Linux Programming and Scripting 3 11-18-2008 02:31 PM
What shell do you use? Aereshaa Linux General 7 07-28-2008 06:29 PM
Using colors in Shell Script ptt3 Linux Programming and Scripting 1 04-03-2008 12:50 PM
FTP Script ptt3 Linux Programming and Scripting 1 04-02-2008 06:54 PM
Your First Date With Vbespy kernel Linux News 0 08-13-2007 10:46 AM


All times are GMT. The time now is 02:20 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.