Normally we can get this("2014-04-24 04:50:10 PM") type of date and time from dateField.I need 24 hour date format like this "2014-04-24 16:50:10" . Is this possible ?
You need to use dateformatter
<mx:DateFormatter id="dateFormatter" formatString="YYYY-MM-DD HH:NN:SS"/>
An example is at the very end here
Related
How can we use momentjs for a time format that has a number of day part prefix?
We can use:
moment("19:41:00", "HH:mm:ss");
What is the time format for:
28.19:41:00
Thanks for helping.
let date = this.moment("28.19:41:00", "DD.HH:mm:ss");
console.log(date.format("YYYY/MM/DD HH:mm:ss")); // 2019/12/28 19:41:00
console.log(date.format("HH:mm:ss")); // 19:41:00
Here is my code (what i have try) :
Dim DataCorrenteLoad As String = DateTime.Now.ToString("dd/MM/yyyy")
TextBox4.Text = DataCorrenteLoad
It works fine but i want the current date with hh:mm , example
30/05/2017 , 16:21
But with that code the (hh:mm) remain 00:00
e.g :
30/05/2017 , 00:00
Someone can help me ? How can i put the correct hour on the date ?
Thanks for help
The .ToSting() accepts a format. You need to put "hh:mm" in addition to "dd/MM/yyyy".
I want to display the local time from an ISO 8601 string using momentjs.
There is a discrepancy of minutes when I convert an ISO string using different date formats. If I use 'MM/DD/YYYY HH:mm', the minutes is correctly displayed. If I use 'ddd, MMM Do HH:MMa', 11 minutes is added (in my case).
My sample js (babel) code:
let today = moment('11/09/2016 00:00', 'MM/DD/YYYY HH:mm').toISOString();
//today = 2016-11-09T08:00:00.000Z
let formatted = moment(today, moment.ISO_8601).format('MM/DD/YYYY HH:mm');
//formatted = 11/09/2016 00:00
let formatted2 = moment(today, moment.ISO_8601).format('ddd, MMM Do HH:MMa');
//formatted2 = Wed, Nov 9th 00:11am
I would prefer using the second format. Can someone explain why there is a discrepancy?
Please see this fiddle: https://jsfiddle.net/anudhagat/8fgtjbc7/3/
I caught my silly mistake. I have capitalized the minutes in the second format, using MM makes it display months instead of minutes.
My task is to use a datepicker to pick a date in the prescribed format, eg(MM-DD-YYYY) and pass it to the server as ISO formatted.
While it test the output the ISO formatted date is one day behind.
For example
If i select
07-13-2015
My Output ISO format is
ISO format is :2015-07-12T18:30:00.000Z
Here you can see date is 13 but the output date is 12
I am from India. I tried with zone and utcOffset, ended up with no results. How do i set it right
Here is the JSFIDDLE
js code
$('#datetimepicker1').on("dp.change",function(e){
var selectedDate = $('#datetimepicker1').find("input").val();
selectedDate = moment(selectedDate,"MM-DD-YYYY");
$(".temp").text(moment(selectedDate).toISOString());
});
I do have a hidden field which value will be updated on change and that will be processed in the server. No issues on that.
$('#datetimepicker1').on("dp.change",function(e){
var selectedDate = $('#datetimepicker1').find("input").val();
selectedDate = moment(selectedDate,"MM-DD-YYYY");
$(".temp").text(selectedDate.toISOString());
});
Your selectedDate is already a moment object so you do not need to feed it back into another moment.
Example:
var test = '07-13-2015'
var mtest = moment(test,"MM-DD-YYYY")
mtest.toISOString()
"2015-07-13T06:00:00.000Z"
Your could try converting the date format to UTC at once.
selectedDate = moment(selectedDate).utc('MM-DD-YYYY')
According to http://dygraphs.com/date-formats.html, if you pass a string like '07-13-2015', it means Midnight of 13th July 2015. Now, if you use toISOString function, it will convert it to UTC by default. To not convert it to UTC, just pass a parameter true in the toISOString function. (Moment.js docs)
For example:
var date = '07-13-2015';
date = moment(date,'MM-DD-YYY');
console.log(date.toISOString(true));
This way, moment will not convert the date to UTC.
How to convert UTC time into date time format in flex. I am using sdk 3.5. for example I have current date time in UTC format as 1309522586000 (milliseconds) and I want to convert it to friday jul 1 2011. How can I do this??
Thanks
If your are using a UNIX timestamp that you are retrieving from your server, first you will have to multiply it by 1000.
This is because UNIX timestamps are expressed in seconds whereas ActionScript timestamps are expressed in milliseconds.
You can create a date from your timestamp as follows:
var myDate:Date = new Date(1309522586000);
Next, you create a formatDate function that you call with myDate as parameter:
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<mx:DateFormatter id="myDF" formatString="EEEE MMM D YYYY"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
private function formatDate(date:Date):void{
trace(myDF.format(date));
}
]]>
</fx:Script>
Notice that I am using a dateformatter to format the date correctly.
More about DateFormatter and possible formats here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/DateFormatter.html
Cheers