HW2.25

import java.util.Scanner;
public class Solution
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter the time zone offset to GMT: ");
int offset = input.nextInt();
input.close();
long totalMilliseconds = System.currentTimeMillis();
long totalSeconds = totalMilliseconds / 1000;
long currentSecond = totalSeconds % 60;
long totalMinutes = totalSeconds / 60;
long currentMinute = totalMinutes % 60;
long totalHours = totalMinutes / 60;
long currentHour = totalHours % 24;
long currentHourWithOffset = currentHour + offset;
if(currentHourWithOffset < 0)
currentHourWithOffset += 24;
else if(currentHourWithOffset > 23)
currentHourWithOffset -= 24;
System.out.println("The current time is " + currentHourWithOffset + ":" + currentMinute
+ ":" + currentSecond);
}
}
HW2.25的更多相关文章
- CSharpGL(25)一个用raycast实现体渲染VolumeRender的例子
CSharpGL(25)一个用raycast实现体渲染VolumeRender的例子 本文涉及的VolumeRendering相关的C#代码是从(https://github.com/toolchai ...
- C#开发微信门户及应用(25)-微信企业号的客户端管理功能
我们知道,微信公众号和企业号都提供了一个官方的Web后台,方便我们对微信账号的配置,以及相关数据的管理功能,对于微信企业号来说,有通讯录中的组织架构管理.标签管理.人员管理.以及消息的发送等功能,其中 ...
- 25 highest paying companies: Which tech co outranks Google, Facebook and Microsoft?
Tech companies dominate Glassdoor’s ranking of the highest paying companies in the U.S., snagging 20 ...
- iOS 25个性能优化/内存优化常用方法
1. 用ARC管理内存 ARC(Automatic ReferenceCounting, 自动引用计数)和iOS5一起发布,它避免了最常见的也就是经常是由于我们忘记释放内存所造成的内存泄露.它自动为你 ...
- gnu coreutils-8.25 for win32 static - Beta
gnu.win32-coreutils-8.25.7z 2.7 Mb bc-1.06.tar.gz coreutils-8.25.tar.xz diffutils-3.5.tar.xz gawk-4. ...
- 25个 Git 进阶技巧
[ 原文] http://www.open-open.com/lib/view/open1431331496857.html 我已经使用git差不多18个月了,觉得自己对它应该已经非常了解.然后来自G ...
- 德国W家HIPP 奶粉有货播报:2014.6.25 HIPP 1+ 4盒装有货啦!
德国W家HIPP 奶粉有货播报:2014.6.25 HIPP 1+ 4盒装有货啦!
- [.net 面向对象程序设计进阶] (25) 团队开发利器(四)分布式版本控制系统Git——使用GitStack+TortoiseGit 图形界面搭建Git环境
[.net 面向对象程序设计进阶] (25) 团队开发利器(四)分布式版本控制系统Git——使用GitStack+TortoiseGit 图形界面搭建Git环境 本篇导读: 前面介绍了两款代码管理工具 ...
- 1Z0-053 争议题目解析25
1Z0-053 争议题目解析25 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 25.You enabled Flashback Data Archive on the INVEN ...
随机推荐
- Java学习--Equals与“==”
在Java规范中,它对equals()方法的使用必须要遵循如下几个规则: equals 方法在非空对象引用上实现相等关系: 1.自反性:对于任何非空引用值 x,x.equals(x) 都应返回 tru ...
- C#基础|面向对象之继承
面向对象的世界 在现实的世界里,发现事物可以进行分类,并且各个分类中又有这关系. 在面向对象的世界里,人们用类来模拟现实世界中的各种关系. 从大的范围来说,人属于人类,如果按照不同的身份将人类进行 ...
- 上传项目到Github
1.使用根工具(均是图形化的界面) TortoiseGit-1.8.12.0-32bit GitExtensions-2.48.05-SetupComplete 2.大致步骤 首先,你需要一个Gith ...
- float([x]): 将一个字符串或数转换为浮点数。如果无参数将返回0.0
float([x]): 将一个字符串或数转换为浮点数.如果无参数将返回0.0 >>> float(12) 12.0 >>> float(-122) -122.0 & ...
- Python中文全攻略
原文链接:http://blog.csdn.net/mayflowers/archive/2007/04/18/1568852.aspx 1. 在Python中使用中文 在Python中 ...
- 【PHP框架CodeIgniter学习】使用辅助函数—建立自己的JSONHelper
本文使用的是2.1.4版本,看的时候请注意. 官方文档:http://codeigniter.org.cn/user_guide/general/helpers.html(关于辅助函数Helper的使 ...
- Win2003部署Framework 4.5框架的MVC4项目
[一篮饭特稀原创,转载请注明出自http://www.cnblogs.com/wanghafan/p/4554672.html] Win2003中IIS6部署Framework 4.5框架的MVC4 ...
- JNI|在子线程中获得JNIEnv|AttachCurrentThread
A JNI interface pointer (JNIEnv*) is passed as an argument for each native function mapped to a Java ...
- 了解实时媒体的播放(RTP/RTCP 和 RTSP)
http://blog.csdn.net/span76/article/details/12913307 RTP/RTCP RTP是基于 UDP协议的, UDP不用建立连接,效率更高:但允许丢包, 这 ...
- Android 自定义title样式
requestWindowFeature(featrueId),它的功能是启用窗体的扩展特性.参数是Window类中定义的常量.一.枚举常量1.DEFAULT_FEATURES:系统默认状态,一般不需 ...