I am using Windward to generate a report with readable dates. Winward uses Excel date/time formatting for formatting, however I am experiencing an issue when formatting a date/time within the 12th hour (eg 12:30) showing as AM rather than PM.
Are my Excel input/output date/time format strings incorrect?
Input format
yyyy-MM-dd hh:mm:ss.S
Output format
dd MMM yyyy h:mm AM/PM
Examples
2016-11-24 00:15:00.0 evaluates to 24 Nov 2016 12:15 AM OK
2016-11-25 12:15:00.0 evaluates to 25 Nov 2016 12:15 AM WRONG
2016-11-26 13:15:00.0 evaluates to 26 Nov 2016 1:15 PM OK
The issue isn't to do with the Excel date/time format strings. Windward uses java's SimpleDateFormat class to evaluate date inputs and Excel Date Formatting to output the formatted date. The following input format works correctly.
yyyy-MM-dd HH:mm:ss.S
As per oracle documentation here.
Letter Date or Time Component Presentation Examples
H Hour in day (0-23) Number 0
h Hour in am/pm (1-12) Number 12
Related
I had to load data from excel to jupyter nb, and when i loaded date time column and changed to datetime object, (column has dates from 1st oct 2022 to 31st oct 2022) until 12th october the date is showing in yyyy-dd-mm format and 13th till 31st oct is showing in yyyy-mm-dd format. I want to make it all in yyyy-mm-dd format. I cant edit the excel sheet alsothis is how the dataframe looks after loading the data and changing format to datetime
I want to get all dates in yyyy-mm-dd format. I tried some methods but they were changing all the dates at once. I only want to change the dates till 12th oct
I'm working on a file that pulls data directly from a web source, but I need to calculate time elapsed since a date. The problem is this is the format the date is appearing in:
Sun May 08 00:00:00 UTC 2016
How to I convert this automatically to MM/DD/YYYY when I refresh the data so that it appears as:
05/08/2016
use:
=--(MID(A1,9,2)&MID(A1,4,5)&RIGHT(A1,4))
and format the output however you want:
Long Date
Fri Aug 07, 2020 05:12 UTC
Day | Date | Time |
Friday | 07:10:2020 | 05:12 |
to get the date from that string use:
=--MID(A1,5,LEN(A1)-8)
Put that in three cells. Then format the cells:
day cell: dddd
Date Cell: dd\:mm\:yyyy
Time Cell: HH:MM
You could use the following to put the text string into just a date time format that excel understands:
=DATEVALUE(RIGHT(LEFT(A1,LEN(A1)-4),LEN(A1)-8))
The above will not be affected by number of digits for year, day or hour; only that the bit it is using has 4 chars at the front (Fri and space) and 4 at the end (space and UTC).
Since you have two digits for both day and hour, this could be simplified with using MID, like:
=DATEVALUE(MID(A1,5,LEN(A1)-8))
To extract a date from a text string representing a date, you can use the DATE function e.g. =DATE([year],[month],[day]).
To get those parts from a text string you can use =MID([input text string], [start position], [number of characters]). So you could do MID for each component (year, month etc) needed, then put the results through the DATE function.
Date formats in Excel are distinguished between what is stored and what is displayed.
What is stored depends on your excel settings.
What is displayed depends on your excel settings as well as your "regional and language options" or equivalent settings in your computer's operating system.
To change what is displayed, set a custom format (ctrl-1, first tab, last list item) to something like Ddd Mmm dd, yyyy hh:mm.
Otherwise regional and language options, and program settings, can override how the date is shown (which can be important if you are sharing workbooks, especially with unknown future users).
Is the input UTC or do you need to convert?
If you need to convert, do you have a fixed offset in hours? If so, it is a simple formula. For example: =A1+3/24 for UTC-3 hours.
To change what is stored, first understand whether the number stored represents the number of days since 1 Jan 1901, or 1 Jan 1904, or some other convention (such as 1 Jan 1970).
Then decide if you want to store it as a date or a text string.
Then decide if you want to store it as 3 copies of the same value (each displaying a different aspect: day, date, time) or if you just want each value to be its own part not the whole date "hidden" and the display set.
To store it as a text string, use =TEXT(A1,"Dddd"), =TEXT(A1,"MM:DD:YYYY") and =TEXT(A1,"HH:MM").
Watch out for 24 or 12 hour time: the difference is whether "AM/PM" is appended. Your input is likely 24h time but check another example from the dataset to be sure.
How can I convert this string:
Tue Jan 24 14:59:20 BRT 2017.
Into a date that includes day month year and time and timezone, using Excel functions only.
I have several cells with dates following this format. I have to compute the difference between some of these dates in minutes. I believe that the first step is converting the date to a String to a real date information. Then, I will be able to: order the dates and compute the time between consecutive dates.
Use this formula:
=--(SUBSTITUTE(MID(A1,5,LEN(A1)),"BRT",""))
Then format it to the format you want.
It will now work in math equations.
I have dates coming out of a database into a column that have this format:
Column K
AUG-14-2015 08:31:32 AM
AUG-12-2015 06:10:03 PM
AUG-12-2015 05:17:51 PM
I want to add like '2.2' days to each of these and put them in Column L. I have formatted the column in this format:
mmm-dd-yyyy hh:mm:ss AM/PM
I wasn't sure if the dashes are causing the problem, but when I do a =K15+2.2 I get a !VALUE. Any ideas what I need to do? Thanks.
After some experimenting, it seems that while you can specify a date format "mmm-dd-yyyy hh:mm:ss AM/PM", the actual entry into the cells must be either a date in the system wide locale specific format, or a number of days since 1 January 1900.
So for example when you set a cell's format to custom:
"mmm-dd-yyyy hh:mm:ss AM/PM"
In my case (Windows 10 default UK locale settings, Excel 2010) for AUG-12-2015 06:10:03 PM, I can enter any of:
12/08/2015 06:10:03 PM
12/08/2015 18:10:03
42228.26
And also exchange the month 08 for Aug or AUG in any case and change the '/' for '-' in the dates.
For cells formatted "mmm-dd-yyyy hh:mm:ss AM/PM", the output for any of the above inputs is:
Aug-12-2015 06:10:03 PM
Note that there does not appear to be a means to force all-capitals for the month.
Note also that if you enter a date/time in the locale format it is automatically recognised and formatted as date/time.
So really your only option is to either change the format of the source data, pre-process the data into locale date/time format, or write a macro to do it within the spreadsheet. It may also work perhaps if you change your locale settings (System Settings, Language & Time), but that is perhaps less than satisfactory because it will affect date presentation for the whole system.
If you want to avoid VBA, then you can add a column("L") next to your data and enter:
=SUBSTITUTE(K1,"-","/")
Another solution would be to write code to do just that to your existing "K" Column