IHYPRESS.NET
RUBY
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
Ruby (CGI Programming) ❯ Time and Date
<18>
#!/usr/bin/ruby puts "Content-type: text/html\n\n" puts "<pre style='font-size:15px;color:blue;'>" time = Time.new # or Time.now puts "Current Time : " + time.inspect puts time.year # Year puts time.month # Month(1 to 12) puts time.day # Day (1 to 31 ) puts time.wday # Day of week: 0 is Sunday puts time.yday # Day of year (1 to 366) puts time.hour # 24-hour clock puts time.min # Minutes (0 to 59) puts time.sec # Seconds (0 to 59) puts time.usec # Microseconds puts time.zone # Timezone name millenium = Time.local(2000, 1, 1, 0, 0) puts "Millenium Begins : " + millenium.inspect puts time.utc_offset # Offset from GMT puts time.isdst # false: If no DST. puts time.gmtime # Convert back to GMT. puts time.getlocal # New Time object in local zone puts time.getutc # New Time object in GMT puts time.strftime("%m/%d/%Y %H:%M:%S") puts "</pre>"
Current Time : 2024-03-28 21:29:30 -0500
2024
3
28
4
88
21
29
30
327917
CDT
Millenium Begins : 2000-01-01 00:00:00 -0600
-18000
true
2024-03-29 02:29:30 UTC
2024-03-28 21:29:30 -0500
2024-03-29 02:29:30 UTC
03/29/2024 02:29:30
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.