I face to problem with IPhone and date.
When I run this code:
const date = new Date('2022-07-04 15:29:00');
alert(date);
But with Iphone chrome I Get following error
Invalid date
With other devices (android, windows, linux) a get correct date.
Does somebody know what kind of problem is in IPhone?
Problem is in date format. Date format has to be in ISO-8061 format.
Related
Is there any way to change phone's system time and date from phone settings programmatically using flutter. I need to change the phones date and time using my app for a purpose. Is there any way? Thank you
your can use app_settings: ^4.1.1 package to open time and date setting. You can open wifi, location, Bluetooth setting also through this package.
but if you have to programmatically change the date and time you have to use java code for this purpose
I hope this link will help you for changing the time programmatically in java
I have a small issue dealing with dates here, I have a multiplatform app using these programing languages iOS/Swift and Android/Kotlin, in my app there is a chat messaging part that these users can use to send messages, the messages are Orderd by date in each device, there will be a date that is gotten from the devise calendar
so in Swift if I say
let date = Date() this date will be the date that's in the device
or in Kotlin
var date = Date()
those variables will give me their device dates so if the user in android sends a message and his clock was a little late his message will be on the top instead of being the last message that was sent and to make it more clear.
example
iPhone device clock is 7:44:33 hh:mm:ss & Android Device clock 7:44:55 hh:mm:ss
if the first message was sent is from the Android and then the iPhone replay to that message, messages should be ordered like this
android: Hi
iPhone: hello there
but instead of that the messages are ordered by the date and comparing the two dates that were given from the devices, the messages are ordered like this
iPhone: hello there
android: Hi
cause the iPhone calendar clock is too early, so my question is this how to get a one date for all the devices by the timezone or any other solution that is available like an international timestamp or something or an international date cause I only need these dates to order my messages nothing else.
I am looking for some guidance on using flutter and taking a UTC datetime from the DB and displaying that time based on mobile devices settings like locale, 24 versus 12 hour time, etc...
I have done dateformating in flutter without an issue, just hoping for some guidance to do it in this manner.
Thanks
I have found that if its for display of a UTC pulled from DB just use the DateTime.toLocal()
Then you can do the formatting on the datetime for other items.
I have a small query, i m developing a calendar application for the iPhone,but i have stuck at a certain point, In xcode there is only a data-picker and this element is not functional in my app because in my app the user must be fast to choose date time. I would to use another instrument for chose a date.
Hey guys please help me.....
I'm not sure I understand your question, but it sounds like you need a way for the user to pick a date/time? Have you seen UIDatePicker?
From your question I can't exactly see what the problem is... the SDK includes UIDatePicker, which you can configure to allow picking the date and time.
I want sync data from iphone to the webs server. My question is how can I know which data is new? the only way I see this is by making a datafield for each record on the server and the iPhone, but how about if the Iphone user is in a different timezone or his datetime is different from the server datetime.
Store all of your dates in GMT on both the server and device. There are several methods for getting GMT easily in Objective-C. The device will determine time-zone based on location. If you need to convert to local time, you can get the date by using the NSTimeZoneClass:
[NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone defaultTimeZone] secondsFromGMT]]
Check out the docs on Date and Time Programming for additional assistance.