datetimetools 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/datetimetools.rb +38 -4
  2. metadata +1 -1
data/lib/datetimetools.rb CHANGED
@@ -1,5 +1,39 @@
1
- class Datetimetools
2
- def self.test
3
- puts "Hello Best Fei!"
4
- end
1
+ #encoding: utf-8
2
+ class Datetimetools
3
+
4
+ def self.test
5
+ puts "Hello Best Fei!"
6
+ end
7
+
8
+ def self.get_date_time(type)
9
+ today = Time.new;
10
+ case type
11
+ when 0
12
+ then return today.strftime("%Y%m%d%H%M%S")
13
+ when 1
14
+ then return today.strftime("%Y年%m月%d日 %H时%M分%S秒")
15
+ when 2
16
+ then return today.strftime("%Y%m%d")
17
+ when 3
18
+ then return today.strftime("%Y年%m月%d日")
19
+ when 4
20
+ then return today.strftime("%H%M%S")
21
+ when 5
22
+ then return today.strftime("%H时%M分%S秒")
23
+ when 6
24
+ then return today.strftime("%Y%m%d_%H%M")
25
+ when 7
26
+ then return today.strftime("%m%d_%H%M")
27
+ when 8
28
+ then return today.strftime("%D")
29
+ when 9
30
+ then return today.strftime("%Y-%m-%d %H:%M:%S %A")
31
+ when 10
32
+ then return today.strftime("%Y-%m-%d %H:%M:%S 第%U个%a")
33
+ else
34
+ return today.strftime("%Y%m%d%H%M%S")
35
+ end
36
+ end
37
+
38
+
5
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datetimetools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: