date-formatting

Format code for a date with time zone in excel

守給你的承諾、 提交于 2019-12-01 17:53:17
I have date value with a time zone. 24 Nov 2005 GMT+05:30 What is the format code for this custom format in Excel? I tried dd MMM yyyy with z , zz , zzz , and Z but Excel ignores those options. Not sure if possible. I've just gone through every letter in custom format cell and nothing looked right. What I would suggest is maybe splitting it up into a few cells and then bringing them all together. In the first column (A1) you could have the date, formatted how you like (dd mmm yyyy). Second (B1) you could have the time before you account for the different timezone (formatted how you like, i.e.

What exactly does trunc(date, 'IW')?

天涯浪子 提交于 2019-12-01 15:37:36
For my project I need to have an absolute numerical correspondence between days of the week and 1...7 values. As you probably know the association between days and numbers can vary according to the locale, for example in Germany Monday is 1 and Sunday is 7, while in US Monday is 2 while Sunday is 1. So, searching for a solution, I found the following code which seems working regardless of the locale, assigning Monday=1...Sunday=7: 1 + TRUNC (date) - TRUNC (date, 'IW') Can someone explain me how does it work? In particular I just can't understand what this instruction: TRUNC (date, 'IW')

What exactly does trunc(date, 'IW')?

﹥>﹥吖頭↗ 提交于 2019-12-01 14:33:57
问题 For my project I need to have an absolute numerical correspondence between days of the week and 1...7 values. As you probably know the association between days and numbers can vary according to the locale, for example in Germany Monday is 1 and Sunday is 7, while in US Monday is 2 while Sunday is 1. So, searching for a solution, I found the following code which seems working regardless of the locale, assigning Monday=1...Sunday=7: 1 + TRUNC (date) - TRUNC (date, 'IW') Can someone explain me

Formatting dates in PostgreSQL

拟墨画扇 提交于 2019-12-01 10:31:17
I have a field which its format is date with time as: YYYY-MM-DD HH-MM-SS for example: 2000-08-12 00:00:00 I want to get just the date part and change its format to DD/MMM/YYYY for example the expected result of the previous example will be: 12/Aug/2000 The field definition is: Ddate timestamp without time zone DEFAULT now() I read the whole page of Date/Time Functions and Operators and other sources as well but I couldn't find any information that is helpful. You can use the to_char function to format your column: SELECT TO_CHAR(ddatte, 'dd/Mon/yyyy') FROM mytable try with: to_char(your_Field

Human-readable, current time sensitive date and time formatting in PHP

一笑奈何 提交于 2019-12-01 10:30:11
Is there a painless way to convert unix timestamps, MySQL timestamps, MySQL datetimes (or any other standard date and time format) into strings in the following form: Today, 6:00pm Tomorrow, 12:30pm Wednesday, 4:00pm Next friday, 11:00am I'm not sure what to call these - I guess conversational-style, current time sensitive date formats? As best I can tell, there is no native function for this. I have created (the start of) a function to do what you are wanting. function timeToString( $inTimestamp ) { $now = time(); if( abs( $inTimestamp-$now )<86400 ) { $t = date('g:ia',$inTimestamp); if( date

PHP Date - How to add a string to separate date and time

谁都会走 提交于 2019-12-01 08:27:20
I want to display date and time format something like this "May 23 at 12:30pm" . I saw in PHP manual and found: // Prints something like: Monday 8th of August 2005 03:12:46 PM echo date('l jS \of F Y h:i:s A'); After modification I manage to get echo date('M j \of h:i a'); it is giving me "May 23 of 12:30pm" but when i replacing of with at it is giving me "May 23 a23 08:26 pm" . I don't what is going wrong. you need to escape the a and t as both have special meaning when used as formatting options in date() echo date('M j \a\t h:i a'); See it in action Try <?php echo date('M j \a\t h:i a'); ?>

how to create Date object from String value

南楼画角 提交于 2019-12-01 06:20:21
问题 When running through the below code I am getting an UNPARSABLE DATE EXCEPTION . How do I fix this? package dateWork; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateCreation { /** * @param args */ public static void main(String[] args) { String startDateString = "2013-03-26"; DateFormat df = new SimpleDateFormat("yyyy/MM/dd"); Date startDate=null; String newDateString = null; try { startDate = df.parse

How to read value of fetched cell data as date google sheets API

喜夏-厌秋 提交于 2019-12-01 06:02:08
I have a spreadsheet that have dates formatted as "Jan 30" etc, but have actual date values. I fetch the data using python google Sheets API like so: def get_spreadsheet_sheets(service, spreadsheetId): spreadsheet = service.spreadsheets().get(spreadsheetId=spreadsheetId).execute() dateCell = "C15" for sheet in spreadsheet['sheets']: sheetTitle = sheet['properties']['title'] rangeName = "%s!%s" % (sheetTitle, dateCell) result = service.spreadsheets().values().get( spreadsheetId=spreadsheetId, range=rangeName).execute() values = result.get('values',[]) values gives me 'Jan 30', I would like to

PHP Date - How to add a string to separate date and time

天涯浪子 提交于 2019-12-01 05:09:04
问题 I want to display date and time format something like this "May 23 at 12:30pm" . I saw in PHP manual and found: // Prints something like: Monday 8th of August 2005 03:12:46 PM echo date('l jS \of F Y h:i:s A'); After modification I manage to get echo date('M j \of h:i a'); it is giving me "May 23 of 12:30pm" but when i replacing of with at it is giving me "May 23 a23 08:26 pm" . I don't what is going wrong. 回答1: you need to escape the a and t as both have special meaning when used as

mysql date format regarding to a specific country

自闭症网瘾萝莉.ら 提交于 2019-12-01 04:18:41
问题 I used MySQL function DATE_FORMAT(table.field, '%d %b %Y') , where the first parameter is my column, and the second is a pattern to format the column according to a date logic. The output of this function is in english : 10 Feb 2014 And I would like to set the locale language to fr_FR which would output this correct string : 10 Fév 2014 Question : How to change locale language of the DataBase right before the query (in order to change it according to another language) ? 回答1: you need to set