timezone

How to save time as UTC time in php/mysql?

I use date_default_timezone_set($_SESSION['time_zone']); to set a users timezone on a page, I am wanting to know, how do I save current time to mysql in php with the current UTC date and time? Also should I be storing it as a timestamp? My existing site used datetime fields and when I saved a new item to mysql I could just use now(...

C# Synchronizing different time zones.

I have an application on a server which is UK based. Say I needed the application to run at the same time for different countries. For arguments sake say I needed it to send an email to a mailbox whenever the time is 7pm in various countries. How would I be able to achieve this? At the moment I just have it running from the Task Sched...

Maybe a dumb question on timezones

Hello all, I have confused myself to a point where I need to double check this with you all. Sorry if this is really a dumb question.. Okay - I have a PHP web application running on Linux that needs to support timezones. I provide a calendar widget that allows the user to set their timezone then select the date and hours/minutes for so...

How to set timezone for SQL?

I'm using SQLite for my cgi application, but the timezone I'm in is different from that of the shared server this stuff is running on. Can I set my timezone somehow in SQLite so I don't need to mess up my application with time conversions and I can use things like NOW() in my SQL? If not: what are my other options? ...

DateTimeOffset adding TimeSpan returns invalid UTC offset for its TimeZoneInfo

I am in the process of building a temporal expression library that must be properly globalized and therefore work in all available Time Zones. Now I seem to be stuck as I'm not sure how to retrieve adjusted dates from DateTimeOffset objects in the correct Daylight Savings Time (DST) when the transition boundary is crossed using any vari...

Timezone help in PHP/MySQL

I have been fighting the timezone battle for weeks now, everyone thinks they know the solution and then they get a million upvotes but the reality is I am totaly 100% stuck, no answer ever given for timezone support in PHP/MySQL has worked 100% for me, so I am asking the question again on here in as much detail as I possibly can with cod...

SystemTimeToTzSpecificLocalTime - how to get utc offset and time zone

I have a need to convert a utc system time to local time and find the corresponding utc offset. I wouldn't mind getting the time zone also. As far as I can tell, SystemTimeToTzSpecificLocalTime returns no information on these. Anyone have a good way of determining the UTC offset and time zone? ...

sql timezone calculation

I have a table which stores the storecodes and their timezone. Now based on a given local date, I need to know if that date converted to stores local date was a in a weekend or not. Now I already know how to get the weekend part. I am struggling with the conversion. I am actually confused. My table has for example the following two value...

Conversion of local time zone to GMT in java

Hello, Am trying convert date which is in local time zone to GMT, i did some thing like this SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); String gmtStrDate = sdf.format(Calendar.getInstance().getTime()); System.out.println("GMT 1"+gmtStrDate...

IllegalAccessException with grails timeZoneSelect tag on google app engine/java

Hi, Has anyone used the grails timeZoneSelect tag on GAE/J ? I've come across the error below on app engine. I know reflection is not allowed, but the line in error seems to be calling a straightforward public function (inDaylightTime)? Does anyone know how to workaround this (short of a hardcoded list of time zones)? thanks Uncaugh...

Best way to save datetime via api in rails.

I have requirement to save datetime (visited_at) attribute via api like POST localhost:3000/visit, but the problem is I don't know how to handle time zone. I have see the explanation about rail time zone support here, but that when you create it through rails form. What I want to know if there is a way to handle this through my own api. ...

Is it possible to install time zones on a server?

I recently had a program fail in a production server because the server was missing a time zone, so the following line threw an exception: TimeZoneInfo.ConvertTime(date, TimeZoneInfo.Local, TimeZoneInfo.FindSystemTimeZoneById("Argentina Standard Time")) I fixed it exporting the time zone registry branch from a test server, importing i...

how to show time and date according to user client (in lamp)

how in lamp (LINUX ,APACHE ,MYSQL ,PHP) environment , can i show date and time in web page according to the user time zone ? THANKS ...

iPhone CurrentTimeZoneOffset from UTC

Is there a way to get the offset time zone for a given date. For example, if I am in New York and I pass in 12-12-2009 4 PM I would get back "-4" as we are 4 hours off GMT. (In .NET land there is a function to do that off the DateTime class. So I'm guess Cocoa has it too?) Ian ...

format as GMT/UTC time when default timezone is something else

Hey all. I have a program which needs to run under my local timezone for other reasons, but for one procedure i need to output dates using a SimpleDateFormat in GMT. what is the tidiest way to do this? ...

How do you change the timezone in PHP for an existing timestamp?

The code for the date and time function: function date_and_time($format,$timestamp) { $date_and_time = date($format,$timestamp); return $date_and_time; } And then the code to display it: <?php echo date_and_time("dS F Y", strtotime($profile[last_activity_date_and_time])); ?> The value of $profile[last_activity_d...

php convert datetime to UTC

I am in need of an easy way to convert a date time stamp to UTC (from whatever timezone the server is in) HOPEFULLY without using any libraries. ...

java incorrect timezone

I have an instance of Java which seems to be using a completely incorrect time zome. Instead of using the Australia/Sydney time zone which Windows is using, it is using the America/Caracas time zone. I checked the Windows time through the system clock firstly, then checked HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/ and ControlSet001, ...

Determine if current local time is between two times (ignoring the date portion)

Considering that there is no NSTime in Cocoa-Touch (Objective-C on iPhone), and given two times as NSStrings and a timezone as an NSString, how can you calculate whether or not the current LOCAL time is between these two times. Keep in mind that the date in the time strings do NOT matter, and are filled with dummy dates. For example: ...

Local time zone offset in PostgreSQL

My web app stores all timestamps in UTC without time zones. I have a shell/psql script that returns a list of recent logins, and I want that script to display login times in the server's local time zone (which may vary depending on where the server is and with daylight savings). To get an interval representing the difference between my...