date-format

How to get a particular date format ('dd-MMM-yyyy') in SELECT query SQL Server 2008 R2

痴心易碎 提交于 2019-12-03 03:23:02
I am using CONVERT(data_type(length),expression,style) function to change the format of a date in a SELECT query. Declare @dt nvarchar(20) Select @dt = Convert(nvarchar(20), SalesDate, 113) FROM SalesTable The format I need is 'dd-MMM-yyyy' (eg. '05-Jul-2013') but I could not find the proper style number (eg. 113) for this particular format. Can any one help me with that please? Try this: Declare @dt NVARCHAR(20) Select @dt = REPLACE(CONVERT(CHAR(15), SalesDate, 106),' ',' - ') FROM SalesTable abcd123 select CONVERT(NVARCHAR, SYSDATETIME(), 106) AS [DD-MON-YYYY] or else select REPLACE(CONVERT

How to format a date in VisualForce?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 01:13:12
In Salesforce, if I'm binding a date into a VisualForce page, how do I apply custom formatting to it? Example: <apex:page standardController="Contact"> <apex:pageBlock title="Test"> <p>{!contact.Birthdate}</p> </apex:pageBlock> <apex:detail relatedList="false" /> </apex:page> This will output a date in the default format: Thu Jul 01 09:10:23 GMT 2009 How do I get it (for example) into dd/mm/yyyy format, like this: 01/07/2009 (Hopefully this is a fairly easy question, but to get the Salesforce community going on here I figure we need a few easy questions.) Ryan Guest <apex:outputText value="{0

Finding max value of a specific date awk

主宰稳场 提交于 2019-12-03 01:12:19
问题 I have a file with several rows and with each row containing the following data- name 20150801|1 20150802|4 20150803|6 20150804|7 20150805|7 20150806|8 20150807|11532 20150808|12399 2015089|12619 20150810|12773 20150811|14182 20150812|27856 20150813|81789 20150814|41168 20150815|28982 20150816|24500 20150817|22534 20150818|3 20150819|4 20150820|47773 20150821|33168 20150822|53541 20150823|46371 20150824|34664 20150825|32249 20150826|29181 20150827|38550 20150828|28843 20150829|3 20150830

Convert date from yyyy-mm-dd to dd month_name year [duplicate]

北城以北 提交于 2019-12-03 01:02:21
问题 This question already has answers here : Convert a date format in PHP (15 answers) Closed 5 years ago . I have stored date in MySQL in the format yyyy-mm-dd and I wish to display it on the form like ddMMMMyyyy How can I do that 回答1: Use DATE_FORMAT() select date_format(date_column, '%d %M %Y') from your_table 回答2: Try it. CONVERT(VARCHAR(11),GETDATE(),106) 来源: https://stackoverflow.com/questions/21160915/convert-date-from-yyyy-mm-dd-to-dd-month-name-year

iOS - Friendly NSDate format

眉间皱痕 提交于 2019-12-03 00:02:52
I need to display the date of posts in my app to the user, right now I do it in this format: "Fri, 25 May". How would I format an NSDate to read something like "2 hours ago"? To make it more user friendly. NSDateFormatter can't do things like that; you're going to need to establish your own rules. I guess something like: - (NSString *)formattedDate:(NSDate *)date { NSTimeInterval timeSinceDate = [[NSDate date] timeIntervalSinceDate:date]; // print up to 24 hours as a relative offset if(timeSinceDate < 24.0 * 60.0 * 60.0) { NSUInteger hoursSinceDate = (NSUInteger)(timeSinceDate / (60.0 * 60.0))

How to change the date format from YYMMDD to YYYY-MM-DD in java? [closed]

我与影子孤独终老i 提交于 2019-12-02 23:51:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am getting the date format from the machine readable code as YYMMDD, how can i change it into YYYY-MM-DD ? for example am getting 871223(YYMMDD) i wand to change it into 1987-12-23(YYYY-MM-DD) is it possible ? can anyone help me with some sample codes? 回答1: The code goes something like this: SimpleDateFormat

Java - Date Format converter? [duplicate]

醉酒当歌 提交于 2019-12-02 23:37:24
问题 This question already has answers here : java.util.Date format conversion yyyy-mm-dd to mm-dd-yyyy (6 answers) Closed 4 years ago . Has java any function where I have a String with a date in this form : ddMMyy or dd.MM.yy and I want to convert it in another format like: dd:MM:yy 回答1: I would suggest using two SimpleDateFormat objects for this. Date date = new SimpleDateFormat("ddMMyy").parse( dateString); String result = new SimpleDateFormat("dd:MM:yy").format( date ); For the format, see the

How to extract and increment the hour from text (str) using Python

半城伤御伤魂 提交于 2019-12-02 23:21:02
问题 For example I have this text (Input): Event Time, Monday: 10:01:02,269 to 10:01:08,702 (Reported by John). Event Time, Sunday: 20:01:08,931 to 20:01:15,234 (Reported by Peter). ... Then you want to alter and increase the time (only the time), thus (Output): Event Time, Monday: 10:01:02,369 to 10:01:09,002 #Change the microseconds and seconds (Reported by John). Event Time, Sunday: 20:01:09,131 to 20:01:15,934 #Change the microseconds and seconds (Reported by Peter). Once I have the times, I

PHP Timestamp into DateTime

…衆ロ難τιáo~ 提交于 2019-12-02 17:48:45
Do you know how I can convert this to a strtotime, or a similar type of value to pass into the DateTime object? The date I have: Mon, 12 Dec 2011 21:17:52 +0000 What I've tried: $time = substr($item->pubDate, -14); $date = substr($item->pubDate, 0, strlen($time)); $dtm = new DateTime(strtotime($time)); $dtm->setTimezone(new DateTimeZone(ADMIN_TIMEZONE)); $date = $dtm->format('D, M dS'); $time = $dtm->format('g:i a'); The above is not correct. If I loop through a lot of different dates its all the same date. You don't need to turn the string into a timestamp in order to create the DateTime

Finding max value of a specific date awk

半世苍凉 提交于 2019-12-02 14:51:11
I have a file with several rows and with each row containing the following data- name 20150801|1 20150802|4 20150803|6 20150804|7 20150805|7 20150806|8 20150807|11532 20150808|12399 2015089|12619 20150810|12773 20150811|14182 20150812|27856 20150813|81789 20150814|41168 20150815|28982 20150816|24500 20150817|22534 20150818|3 20150819|4 20150820|47773 20150821|33168 20150822|53541 20150823|46371 20150824|34664 20150825|32249 20150826|29181 20150827|38550 20150828|28843 20150829|3 20150830|23543 20150831|6 name2 20150801|1 20150802|4 20150803|6 20150804|7 20150805|7 20150806|8 20150807|11532