Mule Date Conversion - mule

My scenario
My Mule flow reads a file and update Salesforce.
Date field in file - 6/2/2015 5:06:00 AM
It will be updated in a datetime field in Salesforce. I am not able to figure out the mapping in the data mapper. Any pointers please.. Thanks!

1.Right click the field ( Date field) in Data Mapper- In format Option, place your required format example:dd.MM.yyyy. if it is not working, try the below option
Can also use the script to format Date
output.Required_Date = calendar2str(input.validDate, "dd.MM.yyyy HH.mm.ss");
Please read DataMapper documents for more details

Related

How to Read specific column value from .text file in wso2 esb

I am starting to work with wso2 esb from few days back.
I need to read particular column value and set into property in wso2 esb.
My .txt file contains following values:
**SNO|FIRSTNAME|LASTNAME|EMAIL|PHONE|ADDRESS|SELLING_DEALER**
**51|christopher|chris|cpko78#gmail.com|0406-755909|US|MacGgor**
I need to read email and phone column value from this .txt file and set into property which can be used for further operations like EmailValidation or PhoneValidation.
Can anyone help me out to fine solution?
If you use ESB one option would be to do a smooks transformation into xml and then read the values from the generated xml. Just keep in mind that if you need the original csv content later in your proxy/api, you need to store the original content and restore it after you've read the needed values (using enrich mediator).
https://docs.wso2.com/display/ESB481/Smooks+Mediator
Another option would be to do a xslt transformation into xml (similar to smooks).
https://docs.wso2.com/display/ESB481/XSLT+Mediator
The last option I could think of is using the script mediator and extract the values using JavaScript, Groovy, or Ruby.
https://docs.wso2.com/display/ESB481/Script+Mediator
If you use EI then you also might expose your csv as a data service.
https://docs.wso2.com/display/DSS351/Exposing+CSV+Data+as+a+Data+Service
Hope that helps.

Updating date in fields in project

I have the following problem updating MS Project fields with VBA:
I try this:
For Each t In ActiveProject.Tasks
'The following displays correctly Mo 14.05.18
Debug.Print Format(CDate("14.05.18", " ddd dd.mm.yy"))
'The following results in an error 438 (Method not supported)
t.Datum3 = Format(CDate("12.05.18","ddd dd.mm.yy"))
'this works fine but i'm not able to sort it proberly since it is a text sort for date fields, which is not wanted ...
't.Text25 = Format(CDate("12.05.15","ddd dd.mm.yy"))
Next t
It seems that not the format is a problem (I tried various formats, I even read it from the object to verify with format should be used) but generally, I'm not able to update date fields, I've got these problems with predefined date fields from MS Project as well as with user defined date fields.
Text fields don't make any problems at all.
Run-time error 438: Object doesn't support this property or method
You are getting the run-time error 438 because the Task object does not have a property called Datum3. Even though the field title in the German version is "Datum3", the actual property name is Date3. (see MS Project object model, German version)
Secondary issue
While MS Project will accept date field values formatted as text, it is not necessary and bad form as it implies the date field is text. Instead set the values like this:
t.Date3 = CDate("14.05.18")
Note: The display format for date fields is set in the Project Options (see Change the Date Format or Ă„ndern des Datumsformats).
Rachel's answer is best... but, another approach if your core need is to sort and you are stuck with text, is to use dates in ISO 8601 format: YYYY-MM-DD . See https://en.wikipedia.org/wiki/ISO_8601 for details. Or better yet: https://xkcd.com/1179/ .

How to get last write date of a RavenDB document via C#

In the Raven Studio UI, when you look into a document you can read (on the right of the page) the last write date of the document.
I don't find any access via the client API in C# to this information. Do you know if it's possible ?
The last modifed date is stored in the metadata of the document. You can access it like this:
var product = session.Load<Product>(1);
RavenJObject metadata = session.Advanced.GetMetadataFor(product);
// Get the last modified time stamp, which is known to be of type DateTime
DateTime lastModified = metadata.Value<DateTime>("Last-Modified");
See Working with document metadata for more information about RavenDB's metadata.

Date format in HTML cfgrid or SQL date format

I am trying to format dates in an HTML cfgrid. I cannot seem to make it work in CF when using HTML as the grid type. I have also tried doing it in MSSQL by using - CONVERT(VARCHAR(10), startDate, 101) AS startDate.
When I do that it shows up right in the grid but the grid will not sort on the date properly.
I understand why converting it to varchar screws up the sort but I cannot seem to make this work in either CF or SQL.
Anyone know of a way to make it show up in the grid in a mm/dd/yyyy format and also sort on the date properly?
Ability to use the mask attribute in html grids was added in CF9. To get it to work on dates you also have to specify type=date
<cfgridcolumn mask="m/d/Y" type="date" ... >
If you are using an html cfgrid, you need to use the formats found in the Ext JS Date class. NOT the date format for Flash.
Here is a link to the Ext JS Date class
<cfgridcolumn ... mask="mm/dd/yy">
source

Using drupal profile date in vb.net

I am using drupal databas ein one of my application. Drupal profile saves date in following format:
a:3:{s:5:"month";s:1:"2";s:3:"day";s:2:"18";s:4:"year";s:4:"1995";}
I can read this with data reader but how to convert in a proper display like DD/MM/YYYY or YYYY/MM/DD
Well, you can kind of see the values for month, day and year in that zany string. Presumably there is something in VB that can help you parse and glue together the string as you need it?
You might look into how PHP's unserialize() works, that will reformat the string to a more usable array.
Most of all, dont use profile, use content_profile and cck. Problem solved. Unserializing PHP serialization can get a bit hairy.