Monotouch dialog DateElement returning wrong date - dialog

I have a very strange problem with a Monotouch.Dialog DateElement. To explain what I'm doing:
I have some weight entries for dates stored in a DB. all entries are shown in a TableView.
if I click "add" i go to a DialogViewController with a DateElement and a counterelement - everything works fine.
If I select a row in the tableView i go to the same DialogViewController and i can edit the entry.
If i edit the weight (counterelement) everything is ok but if I edit the date (DateElement) i get a wrong date back.
when editing a weight entry i instanciate the DateElement like this:
dateElement = new DateElement ("Dato",weightObject.Date);
when the save button is clicked I take the new value from "dateElement.DateValue.Date" and this is where things goes wrong. I ALWAYS get a date back that is 1 day less than what I selected.
I know it sounds strange.... but I have tried tracing my way through this and can't find any bug in my code. Anyone else seen something like this?
(if I click the date and go back again without changing it then there is no problem - the problem is only there when i edit the date)
/Nicolaj

I think i found the "bug".
I'm only interested in the date - not the hours, so when i save the date I take the value like this from the dateelement:
"dateElement.DateValue.Date"
Later, when I want to edit the date I assign for ex "2012-03-18 00:00:00" to the date element.
When i get that value back it have been converted from CET to UTC somehow which means that i get the previous date :-(
So I guess i have to convert back to local time

Converting back to Local time would be done with:
dateElement.DateValue.ToLocalTime()

Related

Value of the cell moves to the left after editing in the userform

I have been facing a strange issue lately. So, the user has the ability to change value of the cell from the userform window, however, after apply changes somehow the values go from the right to the left (only ones with decimals) and that creates a problem when the data is read by another software (Matlab) it can not be read. I have tried to reformat it as number or general to see what happens but nothing. The only thing that changes it back to the right is (find & Replace "," with ","). Anyone knows why this happens? Any solutions ? (see picture for demonstration)
Maybe look in the code for the user form. As I understand it the edit box treats everything as a string. So when the number goes initially from the sheet to the form it is converted into a string. Hence when it is written back, the sheet thinks it’s a string. In the code underlying the form you need to intervene and turn the string back to a number (eg using CDbl() ). If you enter a value (or change) a number directly on the sheet, Excel will try and be ‘helpful’ and convert things that look like numbers into numbers (it does the same with dates). – Solution by #DS_London

Excel having a field day changing the appearance of dates

I have a mac - sigh. I am using excel on the mac.
All date fields have the type of "date", with a format of month/day/year (eg 3/14/2019)
If I enter the value as 10/13/2019, then all is well.
If I enter the value as 10/12/2019, then excel will store it as 10/12/2019, but display it as 12/10/2019
What I mean is that looking at the cells, you'll see 12/10/2019. However, if you click on the cell, then in the little text field at the top, the cell contents are displayed as "10/12/2019".
This is going to confuse the hell out of my american co-workers - it is already confusing me.
I can solve this by putting a ' in front of the 10/12/2019 date... but I'm not sure why Excel is doing its best to make such a mess of this. Is there some way to tell it to stop "auto correcting" things?

TEXT function doesn't show months or year

My =TEXT won't work. It doesn't show months or years. I have downloaded the example template from the support page of Microsoft but I can't make it work. It does show days, which is weird. It doesn't matter which file or sheet I try, same result.
I have tried to change the number formats and reinstalled Excel, without progress. I don't know what is wrong.
See the second comment in the answer to this question:
Formating a date in excel when combining text from multiple cells
I'm not sure about months, but try ÅÅÅÅ instead of YYYY. You can try hitting ctrl+1, selecting "Custom" from "Category" in the "Number" tab. Scroll down until you get to starter codes for date formatting. That may show you what code is needed for TEXT.
You say you are using the English version, but your screenshot is showing torsdag instead of Saturday.

Date Picker appears oversized bug

I am using a date picker in excel, that looks like this:
However whenever other users open the same excel file, and click on the drop down arrow, from the date picker, the calendar view looks buggy. More specifically it takes over the whole top of the screen, like in the picture below.
Where is this coming from, and how can I fix it? It's been driving me nuts?

How to get the completion time of a task in Outlook

I've written a VBA macro that exports in excel all completed (ticked) mails from a mailbox based upon the TaskCompletedDate property. However TaskCompletedDate shows only the date portion of the DateTime value. Is there a way to getthe time value as well?
I'm using Outlook 2010.
Documentation reads that it returns Date type, so you can't get exact time I'm affraid, unless you save it on your own in the first place.
yes you can get the time as well. For this first go to your outlook express mailbox. Then right click on the column header and select "View Settings". Now in the pop-up window click "Format Columns". Now select the "Flag Completed Date" column on the left hand side and then from the format drop down select the 1st, 2nd or 3rd option. Click ok and come out of settings.
Now whenever you extract the info from the taskcompleteddate property you will get the time as well.
I am too late to answer... i have joined recently. But I hope this will help someone else who might be looking for it.
Regards,
Premanshu
You cannot do that - Outlook only stores the date (in the UTC time zone). You can see the data on the MAPI level in OutlookSpy (I am its author - select the task, click IMessage button).

Resources