34.204.169.76 |    

Navigation

Google Advertisement

format
  1. #!/bin/bash
  2.  
  3.  
  4. function format() {
  5.  
  6. [ "$#" -ne 4 ] && exit 1
  7. if [ "$1" = "date" ]; then
  8. 	printf "%04d-%02d-%02d\n" "$2" "$3" "$4"
  9. else
  10. 	printf "%02d:%02d:%02d\n" "$2" "$3" "$4"
  11. fi
  12.  
  13. }
  14.  
  15. #----- format year   mon  day
  16. format "date" "2005" "9" "22"
  17.  
  18. #----- format hour min sec
  19. format "time" "2" "9" "22"
Parsed in 0.003 seconds at 96.77 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 6 users online.

Tags Cloud

Latest snippets
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)
STDERR
(Bash::Function)
radius
(CSS)
shadow
(CSS)
rotate
(CSS)
create_function
(JavaScript::Snippets)