Date format in HTML cfgrid or SQL date format - sql

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

Related

Mule Date Conversion

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

how to check current system date format?

How can i check the system date format? Tried with the code below, but when i change my system's date format to another date format to test the code, it's still showing the date format before changed!
System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern()
Ok. I managed to find the solution, the 'CurrentCulture' has to be 'CurrentUICulture', instead of CurrentCulture. Which is as below:
System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern()

How to change Unix Timestamp to Human Date in rails 3

I've seen a couple of posts doing the reverse for mysql, but I'm looking for a way to change a unix timestamp to a human readable date (ideally one I can change the format of) and I haven't been able to find anything so far.
I'm storing a date pulled from an XML feed, via NokoGiri (in Rails 3.1.1) as part of a hash:
'date' => i.xpath('#unix-timestamp')
which gets the number fine, but how the devil do you make this DD-MM-YYYY to be put in one of my views?
I've tried Time.at( (i.xpath('#unix-timestamp') ) to no avail; I just get the error 'can't convert Nokogiri::XML::NodeSet into an exact number' and now I've hit a wall
Much gratitude for any help!
Time.at is definitely a call that should work to convert from epoch time to a ruby Time object (see here for an example). So it seems like you need to work on converting your XML result into something more usable. I think you want to try using NodeSet#text to get a string output, then converting that to an integer:
Time.at(i.xpath('#unix-timestamp').text.to_i)
There's a decent but basic tutorial for NokoGiri in the Engineyard blog
You can use like : DateTime.strptime("1373210218",'%s')
and also Time.at(1373210218).strftime("%B %e, %Y at %I:%M %p")

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.

What is the safest way to use select with DataTables when filtering on dates in VB.NET?

This will work in US regional settings
table.Select("[Date] = "#04/16/1984#"
This should work in german regional settgins but it thorws dateformat excpetion
table.Select("[Date] = "#16.04.1984#"
To me it seems that datatable does not understand current regional settings. Is there a way to pass date in a certian format, so it will work in any regional setting?
To use Dates with DataTable.Select, you need use InvariantCulture Format and enclose it with #
At Debug:
? TD.Select ("fisap=#9/25/2011 00:00#").Length
20
? TD.Select ("fisap=#9.25.2011 00:00#")(0)(10).ToString
"25/09/2011 0:00:00" - (Spanish)
? TD.Select ("fisap=#9/25/2011 00:00#")(0)(10)
#9/25/2011# {Date}
I guess it depends on the underlying datastore date and time settings, as it is it that stores the information. So, if you're client application is in another regional settings format, make sure to format your date string into the right database settings.
I think this should be helpful: DateTime.Parse Method (String)