2

Get the date and time zone of a form

 2 years ago
source link: https://www.codesd.com/item/get-the-date-and-time-zone-of-a-form.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Get the date and time zone of a form

advertisements

I get an array from a form $formData:

Array ( [first_name] => 12 [last_name] => 1 [date] => DateTime Object ( [date] => 2008-01-01 00:00:00 [timezone_type] => 3 [timezone] => Europe/Berlin ) [sex_id] => 1 [terms] => 1 )

How do I get to [date] and [timezone]?

This doesn't work:

$formData['date']->getTimezone();


As long as $formData['date'] really returns an object of type DateTime getTimezone() will work. This will return the DateTimeZone object.

In order to get the timezone's name use:

$formData['date']->getTimezone()->getName()

... or ...

timezone_name_get($formData['date']->getTimezone());

Related Articles

How do I get the date and time of the timestamp in the PostgreSQL selection query?

How to get the date and time only up to minutes, not seconds, from timestamp in PostgreSQL. I need date as well as time. For example: 2000-12-16 12:21:13-05 From this I need 2000-12-16 12:21 (no seconds and milliseconds only date and time in hours an

Bash: get the date and time of another timezone

I would want to get the date and time from another time zone (UTC-4) with a bash command, but I don't want to configure it as the default TZ for the system. Is there a simple way to do it? E.g 1 (current): $ date fri nov 7 13:15:35 UTC 2014 E.g 2 (wh

How do I get the date and time of a publication?

I got this feedback form I made, and I would like to get the date and time, when a person posted a feedback, and display it next to their name. So, how can I get the date and time? Here is the code for the form: <?php if(isset($_POST['add'])){ $name

Get the date and time the photo was taken from EXIF ​​data using PIL

I can get the EXIF data from an image using PIL, but how can I get the date and time that the photo was taken?Found the answer eventually, the tag I needed was 36867: from PIL import Image def get_date_taken(path): return Image.open(path)._getexif()[

how to get the date and time from PC2 to PC1?

Hello I'm having trouble how can I overcome this problem I search some articles but some examples provided is in PHP. As my title above how can I get the Date and Time from the PC2(Server side where I publish my project) (example of date and time is

What is the best way to get the date and time on the server side?

I'm developing an asp.net mvc3 project. I have a trouble in this problem that I encounter. I will give a scenario so that it will understand well. Scenario: I have 2 PC (PC1(server) and PC2(client)). For example both two PC has different date and tim

Get the date and time from the text

So, I was searching for this for some time but I didn't find an answer. Thats why I'm asking here. My problem goes like this: With Swing I made an app that will get text from JTextArea and then save it inside a .txt document. Also it will save 2 more

JavaScript gets the date and time of the timestamp

I have this field as part of a web response: datetime_local: "2015-02-16T19:00:00" Can I extract the date and time? For instance I would like to display February 16th at 7pm Is this possible?Use this function function getFormattedDate(date) { va

The easiest way to get the date and time in javascript

For instance in C# there is DateTime.Now.ToString("yyyyMMddHHmmss"); Which will output exactly what it looks like in one short concise line, is there something like that with javascript or jQuery that doesn't require handling each part of the da

How to get the date and time of the selected time zone of uipicker in Xcode

I'm trying to display date and time of selected time zone from uipicker in a label or text field I'm not getting any way to solve this problem, so please any one help me Thanks in advance. SelectedTimeZone= [Weight objectAtIndex:[pickerView selectedR

Get the date and time in .NET

Currently I am trying to get the hour and minute using this code: DateTime currentDate = DateTime.Now.Date; int currentHour = DateTime.Now.Date.Hour; int currentMin = DateTime.Now.Date.Minute; But I am getting zero instead to the current hour and min

Get the date and time in milliseconds

I would like to create a function that will fill a struct with the current date and time, such as: typedef struct DateAndTime { int year; int month; int day; int hour; int minutes; int seconds; int msec; }DateAndTime; I know I can use localtime() fro

Get the date and time for Apple Server

I'm developing an app that can only be used during a certain time of the day. I can't get the local device time because the user can easily change the device time thereby allowing access to the application for any time of the day. Is there a way to g

How to get the date and time in program C

I have something like this: char *current_day, *current_time; system("date +%F"); system("date +%T"); It prints the current day and time in the stdout, but I want to get this output or assign them to the current_day and current_time va

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK