I would like to convert a date into a text like:
194408100800
Where the date is 19440810 and the time 0800.
If possible I would like the translation to be
On August 10, 1944 at 08h00 the following happened.
Any idea how to do it?
I would appreciate knowing the coding required.
Thanks
Serge Angeric
Related
What is this date format called: 1YYMMDD
Example: 06/28/1959 outputs as 1590628
Example: 06/28/2019 outputs as 1190628
There is always a stinking 1 in front of it, no matter what.
As #TomNash already mentioned in his comment the 1 seems to be a century marker.
So your date format is CYYMMDD where C could be
0 : for 19xx
1 : for 20xx
This kind of format is not part of ISO 8601!
It looks to be a little bit like an IBM special and maybe AS/400 specific solution for the year-2000-problem.
My personal recommendation is to convert such date formats always to ISO 8601 via an intermediate layer before processing them.
Last but not least please remember to set software that use such outdated formats onto a list, because a solution like the century marker has only moved the year-2000-problem 100 years to the future - so the childs of our grandchilds will have the same problem again ...
I am using SSIS to create a data flow that imports a flat file into a database table. One of the transformations that needs to be done is to convert the date in the flat file which is formatted like "30AUG2013" to a datetime datatype format that can be written into the table. I believe this format would be 2013-08-30.
I am currently using an expression in the Derived Column Transformation editor to move the "30" to the end and move the "2013 to the beginning using SUBSTRING and RIGHT functions. I am having problems however, changing the AUG to 08 (keep in mind the solution would need to handle all months, not just August). Is there any way to do this within the expression editor? This is what I have so far.
(RIGHT(Service_Date,4)) + "-" + (SUBSTRING(Service_Date,3,3)) + "-" + (SUBSTRING(Service_Date,1,2))
So currently that would return: 2013-AUG-30
How can I change that AUG to 08 (or APR to 04, MAR to 03, etc)?
Also, once I get that into the format "2013-08-30" I should be able to just add the DT_DATE Type cast function in front of it in the expression to be able to successfully import it right?
Thank you in advance for any help, suggestions, tips, etc that you can provide. It is all greatly appreciated.
EDIT: SO, I definitely was over thinking this problem. The solution is as simple as this:
(DT_DBDATE)(SUBSTRING(Service_Date,1,2)+ "-" +(SUBSTRING(Service_Date,3,3)+ "-" +(SUBSTRING(Service_Date,6,4))
This expression just formats the date from 30AUG2013 to 30-AUG-2013 and the DT_DBDATE type cast can convert it to the datetime sql server data type. Thanks for the help!
If your objective is to format the date: 30AUG2013 to 2013-08-30, you may want to try an expression like this
select CAST ('30AUG2013' as date)
This returns
2013-08-30
If you're not scared of a little .net, use a script component:
Dim dateConvert As Date = DateTime.Parse("30AUG2013")
I am trying to take the following value and making it into a date format of dd-MMM-yy
For example: 110412 turns into 04-NOV-12
My formula as of right now is:
(CONCATENATE(MID(E14,3,2),"-",(TEXT(LEFT(E14,2),"MMM")),"-",RIGHT(E14,2)))
It is giving me 04-Jan-12.
Please note that I would like the month to be in all caps.
Try using the "UPPER(foo)" function as a wrapper to make the result all caps.
UPPER((CONCATENATE(MID(E14,3,2),"-",(TEXT(LEFT(E14,2),"MMM")),"-",RIGHT(E14,2))))
or better still:
=MID(E14,3,2)&"-"&UPPER(TEXT(DATE(MID(E14,5,2),MID(E14,1,2),MID(E14,3,2)),"MMM"))&"-"&RIGHT(E14,2)
I would like to get today's date in the following format: mmddyyyy.
Even if it's first of August I still want zeros in front, like so: 08012012.
I think I can use DatePart function for it, but I am not sure how.
Anyone has an idea?
Thanks.
You do not say which application, but in VBA, you can say:
Format(date(),"mmddyyyy")
Application.Text(Date(),"mmddyyyy")
Format(NOW,"mmddyyyy")
NOW gives time as well:
Format(NOW,"hh:mm:ss")
I’m having a problem with date formats.
I need to convert the following string into af date object: 2011-09-19T12:23:51Z
And then convert the date object back to a string with this format: 19. september 2011
I can’t figure out what the “T” and “Z” is all about though?
Can anyone help me?
Kind regards
Jesper
The "T" is to separate the date from the time.
The "Z" shows that this is in UTC.
This is a standard (extended) ISO-8601 format date/time string - it should be easy to parse with whatever libraries iOS provides.