utc

Remove time from GMT time format

て烟熏妆下的殇ゞ 提交于 2019-12-03 23:10:58
I am getting a date that comes in GMT format, Fri, 18 Oct 2013 11:38:23 GMT. The problem is that the time is messing up the timeline that I am using. How can I strip out everything except for the actual date? Inanda Menezes Like this: var dateString = 'Mon Jan 12 00:00:00 GMT 2015'; dateString = new Date(dateString).toUTCString(); dateString = dateString.split(' ').slice(0, 4).join(' '); console.log(dateString); If you want to keep using Date and not String you could do this: var d=new Date(); //your date object console.log(new Date(d.setHours(0,0,0,0))); -PS, you don't need a new Date object,

uint64 UTC time

自古美人都是妖i 提交于 2019-12-03 21:43:33
I have a UTC date time without the formatting stored in a uint64, ie: 20090520145024798 I need to get the hours, minutes, seconds and milliseconds out of this time. I can do this very easily by converting it to a string and using substring. However, this code needs to be very fast so I would like to avoid string manipulations. Is there faster way, perhaps using bit manipulation to do this? Oh by the way this needs to be done in C++ on Linux. uint64 u = 20090520145024798; unsigned long w = u % 1000000000; unsigned millisec = w % 1000; w /= 1000; unsigned sec = w % 100; w /= 100; unsigned min =

In VBA, How to convert a UTC UNIX timestamp to Local timezone Date in a simple way?

ぐ巨炮叔叔 提交于 2019-12-03 20:28:31
As I know, we can use below to roughly convert a UNIX timestamp to a VB Date CDate([UNIX timestamp]/ 60 / 60 / 24) + "1/1/1970" However, the time zone and daylight information are not considered. Time zone is not a big deal. But I cannot get the daylight bias information for a specific UNIX timestamp. Though, daylight bias of Date 1/1 is obviously different from Date 6/1, however, for Date 3/12 or Date 11/5, the daylight bias calculation is very complex. I tried several APIs, like “FileTimeToLocalFileTime” and “GetTimeZoneInformation” , but none of them work. Here is my code that can not

Displaying time and timezone information to the user (what, not how)

回眸只為那壹抹淺笑 提交于 2019-12-03 19:36:34
问题 (This is a question about the UI rather than the technology required to do it) What is the clearest way to display a time for events occurring in different timezones to a user? Does your "average" user understand UTC and timezones? We capture the local time and UTC offset and store it in the database (SQL 2008 DateTimeOffset) for events happening in different timezones. Users are also in a variety of timezones. I'll suggest a couple of answers below so they can be rated but I'd appreciate

How does the (Oracle) Java JVM know a leap second is occurring?

一曲冷凌霜 提交于 2019-12-03 17:58:09
问题 A leap second will occur on June 30, 2015. Different Operating Systems seem to handle this situation differently. In my particular case, we are running a Red Hat 6.4 system with custom Java (JDK 1.7) software that is heavily time-dependent. According to some recent Red Hat released information I found, our system's NTP daemon will ensure the OS automatically handle the leap second by repeating 23:59:59 twice. My question is: if I have a long running JDK 1.7 process, how does it know that a

How to I convert long (currentTimeInMillis) to UTC timestamp?

对着背影说爱祢 提交于 2019-12-03 17:24:32
My client is sending me Long which could be thought as scala> System.currentTimeMillis res3: Long = 1441056836609 scala> How do I convert that into UTC timeStamp? On Server, we are using Java 8 You can use the Instant class methods. import java.time.Instant; import java.time.ZoneOffset; Instant.ofEpochMilli(<yourmillis>).atOffset(ZoneOffset.UTC).toString(); Your example date would be "2015-08-31T21:33:56.609Z" . Date dateFromTime = new Date(timeInMillis); That will get a Date object, which you can then spit out in a proper UTC format using DateFormat dateFormatter = SimpleDateFormat(/*UTC

Get current date time from server and convert it into local time in c#

元气小坏坏 提交于 2019-12-03 16:59:55
Help: I have a server which is having time in GMT-07.00 hours. My local time is GMT+05.30 hours. I need to get current date and time from server and convert this date and time into my local time. I have tried many codes, but still have not found a successive way of doing this. Can somebody please help me out. string zoneId = "India Standard Time"; TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId); DateTime result = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi); DateTime cu = result.ToUniversalTime(); DateTime cur = cu.ToLocalTime(); I have tried all the above methods,

How can I get an accurate UTC time with Python?

做~自己de王妃 提交于 2019-12-03 16:49:47
问题 I wrote a desktop application and was using datetime.datetime.utcnow() for timestamping, however I've recently noticed that some people using the application get wildly different results than I do when we run the program at the same time. Is there any way to get the UTC time locally without using urllib to fetch it from a website? 回答1: Python depends on the underlying operating system to provide an accurate time-of-day clock. If it isn't doing that, you don't have much choice other than to

Changing current user timezone based on server UTC offset and user UTC offset

谁都会走 提交于 2019-12-03 16:48:07
im writing a twitter web service in php. When a user signs in, i receive this node: <utc_offset>-18000</utc_offset> I have to change the script's timezone so that it adapts to the user's real timezone. The only php function i have found for this is: date_default_timezone_set($timezone_identifier) but it won't let me use -18000 as a the $timezone_identifier parameter. So, how can i change the current user timezone based on two values: Server UTC offset and User UTC offset BTW, this is how i'm getting the server UTC offset value: $this_tz_str = date_default_timezone_get(); $this_tz = new

C# convert UTC int to DateTime object

非 Y 不嫁゛ 提交于 2019-12-03 13:37:03
I don't know why this is so complicated! I have a plugin that is passing in a long int UTC. I need to convert that number into a DateTime to query my database (SQL Server). I don't know why, but I can't find a workable answer from a basic google search. (For extra credit, I need to turn my returned DateTime back into a UTC at the end of the day.) This is embarrassing to have to ask such a basic question! :) Jon Skeet My guess is it's going to be either milliseconds or seconds since a particular epoch - quite possibly the Unix epoch of January 1st 1970, midnight UTC. So the code would look